From: Andrew Morton <akpm@linux-foundation.org>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: shuah@kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH -next] selftests/mm: mseal, self_elf: Fix warning comparing pointer to 0
Date: Wed, 17 Jul 2024 20:46:16 -0700 [thread overview]
Message-ID: <20240717204616.7a3d2465272d4f8fd1736831@linux-foundation.org> (raw)
In-Reply-To: <20240718031039.69861-1-jiapeng.chong@linux.alibaba.com>
On Thu, 18 Jul 2024 11:10:39 +0800 Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote:
> Avoid pointer type value compared with 0 to make code clear.
>
> ./tools/testing/selftests/mm/mseal_test.c:486:27-28: WARNING comparing pointer to 0.
> ./tools/testing/selftests/mm/mseal_test.c:1399:29-30: WARNING comparing pointer to 0.
>
> ...
>
> --- a/tools/testing/selftests/mm/mseal_test.c
> +++ b/tools/testing/selftests/mm/mseal_test.c
> @@ -481,9 +481,8 @@ static void test_seal_zero_address(void)
> int prot;
>
> /* use mmap to change protection. */
> - ptr = sys_mmap(0, size, PROT_NONE,
> - MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
> - FAIL_TEST_IF_FALSE(ptr == 0);
> + ptr = sys_mmap(0, size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
> + FAIL_TEST_IF_FALSE(!ptr);
> @@ -1390,13 +1389,12 @@ static void test_seal_mremap_move_fixed_zero(bool seal)
> /*
> * MREMAP_FIXED can move the mapping to zero address
> */
> - ret2 = mremap(ptr, size, 2 * page_size, MREMAP_MAYMOVE | MREMAP_FIXED,
> - 0);
> + ret2 = mremap(ptr, size, 2 * page_size, MREMAP_MAYMOVE | MREMAP_FIXED, 0);
The author of this code chose to make it tractable in an 80-column
display. It's best not to change that, without explanation.
prev parent reply other threads:[~2024-07-18 3:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 3:10 Jiapeng Chong
2024-07-18 3:46 ` 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=20240717204616.7a3d2465272d4f8fd1736831@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=abaci@linux.alibaba.com \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox