[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] use vma_pages()
# HG changeset patch # User Muhammad Falak R Wani <falakreyaz@xxxxxxxxx> # Date 1464185173 -7200 # Wed May 25 16:06:13 2016 +0200 # Node ID 3417f3554ddb8a96acdfe075b7d5ddd350457c99 # Parent 4437d405cfd7099ea45ac2028338990730c24be0 use vma_pages() Replace explicit computation of vma page count by a call to vma_pages(). Signed-off-by: Muhammad Falak R Wani <falakreyaz@xxxxxxxxx> Widen set of adjustments. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Committed-by: Jan Beulich <jbeulich@xxxxxxxx> --- diff -r 4437d405cfd7 -r 3417f3554ddb drivers/char/mem.c --- a/drivers/char/mem.c Wed May 25 16:03:43 2016 +0200 +++ b/drivers/char/mem.c Wed May 25 16:06:13 2016 +0200 @@ -282,7 +282,7 @@ static int mmap_kmem(struct file * file, return -EIO; #ifdef CONFIG_XEN - count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + count = vma_pages(vma); for (i = 0; i < count; i++) if ((pfn + i) != mfn_to_local_pfn(pfn_to_mfn(pfn + i))) return -EIO; diff -r 4437d405cfd7 -r 3417f3554ddb drivers/xen/blktap2/ring.c --- a/drivers/xen/blktap2/ring.c Wed May 25 16:03:43 2016 +0200 +++ b/drivers/xen/blktap2/ring.c Wed May 25 16:06:13 2016 +0200 @@ -282,7 +282,7 @@ blktap_ring_mmap(struct file *filp, stru if (!tap || test_and_set_bit(BLKTAP_RING_VMA, &tap->dev_inuse)) return -ENOMEM; - size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + size = vma_pages(vma); if (size != (MMAP_PAGES + RING_PAGES)) { BTERR("you _must_ map exactly %lu pages!\n", MMAP_PAGES + RING_PAGES); diff -r 4437d405cfd7 -r 3417f3554ddb drivers/xen/fbfront/xenfb.c --- a/drivers/xen/fbfront/xenfb.c Wed May 25 16:03:43 2016 +0200 +++ b/drivers/xen/fbfront/xenfb.c Wed May 25 16:06:13 2016 +0200 @@ -429,7 +429,6 @@ static int xenfb_mmap(struct fb_info *fb { struct xenfb_info *info = fb_info->par; struct xenfb_mapping *map; - int map_pages; if (!(vma->vm_flags & VM_WRITE)) return -EINVAL; @@ -438,8 +437,7 @@ static int xenfb_mmap(struct fb_info *fb if (vma->vm_pgoff != 0) return -EINVAL; - map_pages = (vma->vm_end - vma->vm_start + PAGE_SIZE-1) >> PAGE_SHIFT; - if (map_pages > info->nr_pages) + if (vma_pages(vma) > info->nr_pages) return -EINVAL; map = kzalloc(sizeof(*map), GFP_KERNEL); diff -r 4437d405cfd7 -r 3417f3554ddb drivers/xen/gntdev/gntdev.c --- a/drivers/xen/gntdev/gntdev.c Wed May 25 16:03:43 2016 +0200 +++ b/drivers/xen/gntdev/gntdev.c Wed May 25 16:06:13 2016 +0200 @@ -443,7 +443,7 @@ static int gntdev_mmap (struct file *fli struct gnttab_map_grant_ref op; unsigned long slot_index = vma->vm_pgoff; unsigned long kernel_vaddr, user_vaddr, mfn; - unsigned long size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + unsigned long size = vma_pages(vma); uint64_t ptep; int ret, exit_ret; unsigned int i, flags; @@ -946,7 +946,7 @@ private_data_initialised: goto get_offset_out; } op.offset = vma->vm_pgoff << PAGE_SHIFT; - op.count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + op.count = vma_pages(vma); get_offset_out: up_read(¤t->mm->mmap_sem); if (!rc && copy_to_user((void __user *)arg, &op, sizeof(op))) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |