+ mm-mmapc-use-is_err_value-to-check-return-value-of-get_unmapped_area.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/mmap.c: use IS_ERR_VALUE() to check return value of get_unmapped_area()
has been added to the -mm tree.  Its filename is
     mm-mmapc-use-is_err_value-to-check-return-value-of-get_unmapped_area.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-mmapc-use-is_err_value-to-check-return-value-of-get_unmapped_area.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-mmapc-use-is_err_value-to-check-return-value-of-get_unmapped_area.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: Gaowei Pu <pugaowei@xxxxxxxxx>
Subject: mm/mmap.c: use IS_ERR_VALUE() to check return value of get_unmapped_area()

get_unmapped_area() already covers the offset_in_page() check and returns
with an error ptr.  So replace offset_in_page() with IS_ERR_VALUE().

Link: http://lkml.kernel.org/r/20191010033117.22294-1-pugaowei@xxxxxxxxx
Signed-off-by: Gaowei Pu <pugaowei@xxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/mmap.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/mmap.c~mm-mmapc-use-is_err_value-to-check-return-value-of-get_unmapped_area
+++ a/mm/mmap.c
@@ -1417,7 +1417,7 @@ unsigned long do_mmap(struct file *file,
 	 * that it represents a valid section of the address space.
 	 */
 	addr = get_unmapped_area(file, addr, len, pgoff, flags);
-	if (offset_in_page(addr))
+	if (IS_ERR_VALUE(addr))
 		return addr;
 
 	if (flags & MAP_FIXED_NOREPLACE) {
@@ -3003,7 +3003,7 @@ static int do_brk_flags(unsigned long ad
 	flags |= VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
 
 	error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
-	if (offset_in_page(error))
+	if (IS_ERR_VALUE(error))
 		return error;
 
 	error = mlock_future_check(mm, mm->def_flags, len);
_

Patches currently in -mm which might be from pugaowei@xxxxxxxxx are

mm-mmapc-use-is_err_value-to-check-return-value-of-get_unmapped_area.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux