aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/uio')
-rw-r--r--drivers/uio/uio.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 51fe1795d5a8..10a029b24159 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -587,14 +587,12 @@ static ssize_t uio_write(struct file *filep, const char __user *buf,
587 587
588static int uio_find_mem_index(struct vm_area_struct *vma) 588static int uio_find_mem_index(struct vm_area_struct *vma)
589{ 589{
590 int mi;
591 struct uio_device *idev = vma->vm_private_data; 590 struct uio_device *idev = vma->vm_private_data;
592 591
593 for (mi = 0; mi < MAX_UIO_MAPS; mi++) { 592 if (vma->vm_pgoff < MAX_UIO_MAPS) {
594 if (idev->info->mem[mi].size == 0) 593 if (idev->info->mem[vma->vm_pgoff].size == 0)
595 return -1; 594 return -1;
596 if (vma->vm_pgoff == mi) 595 return (int)vma->vm_pgoff;
597 return mi;
598 } 596 }
599 return -1; 597 return -1;
600} 598}