The patch titled Subject: mm/memory.c: fail when offset == num in first check of vm_map_pages_zero() has been added to the -mm tree. Its filename is mm-fail-when-offset-==-num-in-first-check-of-vm_map_pages_zero.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-fail-when-offset-%3D%3D-num-in-first-check-of-vm_map_pages_zero.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-fail-when-offset-%3D%3D-num-in-first-check-of-vm_map_pages_zero.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx> Subject: mm/memory.c: fail when offset == num in first check of vm_map_pages_zero() If the caller asks us for offset == num, we should already fail in the first check, i.e. the one testing for offsets beyond the object. At the moment, we are failing on the second test anyway, since count cannot be 0. Still, to agree with the comment of the first test, we should first there. Link: http://lkml.kernel.org/r/20190528193004.GA7744@xxxxxxxxx Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Souptick Joarder <jrdr.linux@xxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxx> Cc: Huang Ying <ying.huang@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/memory.c~mm-fail-when-offset-==-num-in-first-check-of-vm_map_pages_zero +++ a/mm/memory.c @@ -1545,7 +1545,7 @@ static int __vm_map_pages(struct vm_area int ret, i; /* Fail if the user requested offset is beyond the end of the object */ - if (offset > num) + if (offset >= num) return -ENXIO; /* Fail if the user requested size exceeds available object size */ _ Patches currently in -mm which might be from miguel.ojeda.sandonis@xxxxxxxxx are mm-fail-when-offset-==-num-in-first-check-of-vm_map_pages_zero.patch