mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Venkat <venkat88@linux.ibm.com>
To: longlong yan <yanlonglong@kylinos.cn>
Cc: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
	chleroy@kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kselftest@vger.kernel.org, shuah@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/powerpc: use MAP_FAILED instead of (void *)-1 in  tm-signal-context-force-tm
Date: Wed, 9 Sep 2026 18:52:36 +0530	[thread overview]
Message-ID: <B7E476E5-441D-42A6-901C-502AB7F38F90@linux.ibm.com> (raw)
In-Reply-To: <20260722023428.932-1-yanlonglong@kylinos.cn>



> On 22 Jul 2026, at 8:04 AM, longlong yan <yanlonglong@kylinos.cn> wrote:
> 
> mmap() is documented to return MAP_FAILED on error, but
> tm-signal-context-force-tm.c compares the return value against
> (void *)-1. Replace these with the standard MAP_FAILED macro for
> better readability and type safety.
> 
> Signed-off-by: longlong yan <yanlonglong@kylinos.cn>
> ---

Tested this patch, by applying on top of mainline.

Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>

# timeout set to 0
# selftests: powerpc/tm: tm-signal-context-force-tm
# test: tm_signal_context_force_tm
# tags: git_version:v7.3-rc2-28-g5572a2d442d5
# success: tm_signal_context_force_tm
ok 18 selftests: powerpc/tm: tm-signal-context-force-tm

Regards,
Venkat.
> .../testing/selftests/powerpc/tm/tm-signal-context-force-tm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c b/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
> index 0a4bc479ae39..5dc0f12f467d 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
> @@ -60,7 +60,7 @@ void usr_signal_handler(int signo, siginfo_t *si, void *uc)
> ucp->uc_link = mmap(NULL, sizeof(ucontext_t),
>    PROT_READ | PROT_WRITE,
>    MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
> - if (ucp->uc_link == (void *)-1) {
> + if (ucp->uc_link == MAP_FAILED) {
> perror("Mmap failed");
> exit(-1);
> }
> @@ -129,7 +129,7 @@ void tm_trap_test(void)
> ss.ss_size = SIGSTKSZ;
> ss.ss_flags = 0;
> 
> - if (ss.ss_sp == (void *)-1) {
> + if (ss.ss_sp == MAP_FAILED) {
> perror("mmap error\n");
> exit(-1);
> }
> -- 
> 2.43.0
> 


  parent reply	other threads:[~2026-09-09 13:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  2:34 longlong yan
2026-07-22  9:39 ` Amit Machhiwal
2026-09-09 13:22 ` Venkat [this message]
2026-09-14  7:21 ` Madhavan Srinivasan

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=B7E476E5-441D-42A6-901C-502AB7F38F90@linux.ibm.com \
    --to=venkat88@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=shuah@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

all inboxes | Powered by JetHome®