On Tue, 7 Jul 2026 11:17:45 +0800 longlong yan <[email protected]> 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/[email protected]