From: Andrew Morton <akpm@linux-foundation.org>
To: longlong yan <yanlonglong@kylinos.cn>
Cc: rppt@kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2] selftests/mm/mseal_test: Fix mmap return value check in test_seal_zero_address
Date: Tue, 7 Jul 2026 14:47:51 -0700 [thread overview]
Message-ID: <20260707144751.fbd08a3dd6839371d001173e@linux-foundation.org> (raw)
In-Reply-To: <20260707031745.1039-1-yanlonglong@kylinos.cn>
On Tue, 7 Jul 2026 11:17:45 +0800 longlong yan <yanlonglong@kylinos.cn> wrote:
> The return value for a failed mmap function is MAP_FAILED.
> According to the definition of FAIL_TEST_IF FALSE,ptr must be
> determined to be distinct from MAP_FAILED
>
> ...
>
> --- a/tools/testing/selftests/mm/mseal_test.c
> +++ b/tools/testing/selftests/mm/mseal_test.c
> @@ -482,7 +482,7 @@ static void test_seal_zero_address(void)
> /* use mmap to change protection. */
> ptr = mmap(0, size, PROT_NONE,
> MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
> - FAIL_TEST_IF_FALSE(ptr == 0);
> + FAIL_TEST_IF_FALSE(ptr != (void *)-1);
>
> size = get_vma_size(ptr, &prot);
> FAIL_TEST_IF_FALSE(size == 4 * page_size);
Has this been tested?
AI review is suggesting the code was supposed to be this way and it
appears to have a point:
https://sashiko.dev/#/patchset/20260707031745.1039-1-yanlonglong@kylinos.cn
prev parent reply other threads:[~2026-07-07 21:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 8:30 [PATCH] selftests/mm/mseal_test: Fix mmap return value check in test_seal_zero_address longlong yan
2026-07-06 11:24 ` Mike Rapoport
2026-07-07 3:17 ` [PATCH v2] " longlong yan
2026-07-07 5:57 ` Mike Rapoport
2026-07-07 21:47 ` Andrew Morton [this message]
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=20260707144751.fbd08a3dd6839371d001173e@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@kernel.org \
--cc=yanlonglong@kylinos.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox