From: longlong yan <hidden> Date: 2026-07-22 02:34:53
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 <redacted>
---
.../testing/selftests/powerpc/tm/tm-signal-context-force-tm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Amit Machhiwal <hidden> Date: 2026-07-22 09:39:44
On 2026/07/22 10:34 AM, longlong yan 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.
The mmap man page does confirm:
RETURN VALUE
On success, mmap() returns a pointer to the mapped area. On
error, the value MAP_FAILED (that is, (void *) -1) is returned,
and errno is set to indicate the error.
So, the MAP_FAILED substitution looks correct. Please feel free to add:
Reviewed-by: Amit Machhiwal <redacted>
Thanks,
Amit
On 22 Jul 2026, at 8:04 AM, longlong yan [off-list ref] 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 <redacted>
---
Tested this patch, by applying on top of mainline.
Tested-by: Venkat Rao Bagalkote <redacted>
# 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.
On Wed, 22 Jul 2026 10:34:28 +0800, longlong yan 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.