Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Libin and committed by
Greg Kroah-Hartman
a0ea59d5 80fe6361

+1 -1
+1 -1
drivers/char/mspec.c
··· 267 267 if ((vma->vm_flags & VM_WRITE) == 0) 268 268 return -EPERM; 269 269 270 - pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 270 + pages = vma_pages(vma); 271 271 vdata_size = sizeof(struct vma_data) + pages * sizeof(long); 272 272 if (vdata_size <= PAGE_SIZE) 273 273 vdata = kzalloc(vdata_size, GFP_KERNEL);