Skip to content

Commit a0ea59d

Browse files
libin2015gregkh
authored andcommitted
char: Use vma_pages() to replace (vm_end - vm_start) >> PAGE_SHIFT
(*->vm_end - *->vm_start) >> PAGE_SHIFT operation is implemented as a inline funcion vma_pages() in linux/mm.h, so using it. Signed-off-by: Libin <huawei.libin@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 80fe636 commit a0ea59d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/char/mspec.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
267267
if ((vma->vm_flags & VM_WRITE) == 0)
268268
return -EPERM;
269269

270-
pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
270+
pages = vma_pages(vma);
271271
vdata_size = sizeof(struct vma_data) + pages * sizeof(long);
272272
if (vdata_size <= PAGE_SIZE)
273273
vdata = kzalloc(vdata_size, GFP_KERNEL);

0 commit comments

Comments
 (0)