All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,shuah@kernel.org,11162571@vivo.com,akpm@linux-foundation.org
Subject: [to-be-updated] tools-mm-check-mmap-based-on-return-values.patch removed from -mm tree
Date: Tue, 03 Sep 2024 20:41:13 -0700	[thread overview]
Message-ID: <20240904034114.4977FC4CEC2@smtp.kernel.org> (raw)


The quilt patch titled
     Subject: tools:mm: check mmap based on return values
has been removed from the -mm tree.  Its filename was
     tools-mm-check-mmap-based-on-return-values.patch

This patch was dropped because an updated version will be issued

------------------------------------------------------
From: Yang Ruibin <11162571@vivo.com>
Subject: tools:mm: check mmap based on return values
Date: Tue, 20 Aug 2024 23:50:03 -0400

To correctly detect whether mmap is successful, must use if (map_ptr ==
MAP_FAILED)to avoid incorrectly handling a valid mapping.

Link: https://lkml.kernel.org/r/20240821035005.4423-1-11162571@vivo.com
Signed-off-by: Yang Ruibin <11162571@vivo.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 tools/testing/selftests/mm/ksm_tests.c     |    2 +-
 tools/testing/selftests/mm/madv_populate.c |    2 +-
 tools/testing/selftests/mm/soft-dirty.c    |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

--- a/tools/testing/selftests/mm/ksm_tests.c~tools-mm-check-mmap-based-on-return-values
+++ a/tools/testing/selftests/mm/ksm_tests.c
@@ -201,7 +201,7 @@ static void  *allocate_memory(void *ptr,
 {
 	void *map_ptr = mmap(ptr, map_size, PROT_WRITE, mapping, -1, 0);
 
-	if (!map_ptr) {
+	if (map_ptr == MAP_FAILED) {
 		perror("mmap");
 		return NULL;
 	}
--- a/tools/testing/selftests/mm/madv_populate.c~tools-mm-check-mmap-based-on-return-values
+++ a/tools/testing/selftests/mm/madv_populate.c
@@ -34,7 +34,7 @@ static void sense_support(void)
 
 	addr = mmap(0, pagesize, PROT_READ | PROT_WRITE,
 		    MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
-	if (!addr)
+	if (addr == MAP_FAILED)
 		ksft_exit_fail_msg("mmap failed\n");
 
 	ret = madvise(addr, pagesize, MADV_POPULATE_READ);
--- a/tools/testing/selftests/mm/soft-dirty.c~tools-mm-check-mmap-based-on-return-values
+++ a/tools/testing/selftests/mm/soft-dirty.c
@@ -134,7 +134,7 @@ static void test_mprotect(int pagemap_fd
 	if (anon) {
 		map = mmap(NULL, pagesize, PROT_READ|PROT_WRITE,
 			   MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
-		if (!map)
+		if (map == MAP_FAILED)
 			ksft_exit_fail_msg("anon mmap failed\n");
 	} else {
 		test_fd = open(fname, O_RDWR | O_CREAT, 0664);
_

Patches currently in -mm which might be from 11162571@vivo.com are



                 reply	other threads:[~2024-09-04  3:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240904034114.4977FC4CEC2@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=11162571@vivo.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.