All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Hongfu Li <lihongfu@kylinos.cn>
Cc: akpm@linux-foundation.org, david@kernel.org, liam@infradead.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-mm@kvack.org, ljs@kernel.org, mhocko@suse.com,
	shuah@kernel.org, surenb@google.com, vbabka@kernel.org
Subject: Re: [PATCH v3 2/2] selftests/mm: add missing mmap() return checks in pkey tests
Date: Thu, 28 May 2026 14:15:28 +0300	[thread overview]
Message-ID: <ahgj0GlE32AzNq3H@kernel.org> (raw)
In-Reply-To: <20260528085746.2076957-1-lihongfu@kylinos.cn>

On Thu, May 28, 2026 at 04:57:46PM +0800, Hongfu Li wrote:
> > > @@ -1693,7 +1694,10 @@ int main(void)
> > >  		printf("running PKEY tests for unsupported CPU/OS\n");
> > >  
> > >  		ptr  = mmap(NULL, size, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
> > > -		assert(ptr != (void *)-1);
> > > +		if (ptr == MAP_FAILED) {
> > > +			perror("mmap");
> > > +			return EXIT_FAILURE;
> > > +		}
> > 
> > Just stick to pkey_assert() everywhere, it already prints errno and exits.
> 
> This is a pre-test initialization path that runs before the test loop,
> so test_nr and iteration_nr are not yet set up for pkey_assert().
> 
> Should we just use their initial values here directly?

I think it's fine if pkey_assert() would print the initial values.
Or you can use ksft_exit_fail_perror() here.
  
> > >  		test_mprotect_pkey_on_unsupported_cpu(ptr, 1);
> > >  		exit(0);
> > >  	}
> > > @@ -1706,5 +1710,5 @@ int main(void)
> > >  		run_tests_once();
> > >  
> > >  	printf("done (all tests OK)\n");
> > > -	return 0;
> > > +	return EXIT_SUCCESS;
> > 
> > Completely unrelated and not needed.
> > 
> > And you may want to base your work on mm-unstable to get up to date version
> > of protection_keys tests.
> 
> Sure, I will base my changes on top of the latest mm-unstable branch.
> 
> Best regards,
> Hongfu

-- 
Sincerely yours,
Mike.


      reply	other threads:[~2026-05-28 11:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27  1:38 [PATCH v3 0/2] selftests/mm: refactor pkey helpers and fix mmap error handling Hongfu Li
2026-05-27  1:38 ` [PATCH v3 1/2] selftests/mm: refactor pkey test helpers and unify assertions Hongfu Li
2026-05-27 11:32   ` Mike Rapoport
2026-05-28  9:13     ` Hongfu Li
2026-05-28 11:11       ` Mike Rapoport
2026-05-27  1:38 ` [PATCH v3 2/2] selftests/mm: add missing mmap() return checks in pkey tests Hongfu Li
2026-05-27 11:36   ` Mike Rapoport
2026-05-28  8:57     ` Hongfu Li
2026-05-28 11:15       ` Mike Rapoport [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=ahgj0GlE32AzNq3H@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=liam@infradead.org \
    --cc=lihongfu@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=shuah@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@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.