selftests/arm64: Fix build warnings for abi
PATCH 1/1 selftests/arm64: Fix build warnings for abi
A "%s" is missing in ksft_exit_fail_msg(); instead, use the newly introduced ksft_exit_fail_perror(). Also, uint64_t corresponds to unsigned 64-bit integer, so use %lx instead of %llx.
---
The changes in ptrace.c were earlier a part of the following:
https://lore.kernel.org/all/[email protected]/
which were reviewed by Mark.
tools/testing/selftests/arm64/abi/ptrace.c | 4 ++-- tools/testing/selftests/arm64/abi/syscall-abi.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/arm64/abi/ptrace.c +2 -2
@@ -163,10 +163,10 @@ static void test_hw_debug(pid_t child, int type, const char *type_name)static int do_child (void ) {if (ptrace (PTRACE_TRACEME ,-1 ,NULL ,NULL )) -ksft_exit_fail_msg ("PTRACE_TRACEME" ,strerror (errno)); +ksft_exit_fail_perror ("PTRACE_TRACEME" );if (raise (SIGSTOP )) -ksft_exit_fail_msg ("raise(SIGSTOP)" ,strerror (errno)); +ksft_exit_fail_perror ("raise(SIGSTOP)" );return EXIT_SUCCESS ; }
tools/testing/selftests/arm64/abi/syscall-abi.c +4 -4
@@ -81,7 +81,7 @@ static int check_gpr(struct syscall_cfg *cfg, int sve_vl, int sme_vl, uint64_t s*/ for (i =9 ; i <ARRAY_SIZE (gpr_in); i++) {if (gpr_in[i] != gpr_out[i]) { -ksft_print_msg ("%s SVE VL %d mismatch in GPR %d: %llx != %llx\n" , +ksft_print_msg ("%s SVE VL %d mismatch in GPR %d: %lx != %lx\n" , cfg->name, sve_vl, i, gpr_in[i], gpr_out[i]); errors++;
@@ -112,7 +112,7 @@ static int check_fpr(struct syscall_cfg *cfg, int sve_vl, int sme_vl,if (!sve_vl && !(svcr &SVCR_SM_MASK )) {for (i =0 ; i <ARRAY_SIZE (fpr_in); i++) {if (fpr_in[i] != fpr_out[i]) { -ksft_print_msg ("%s Q%d/%d mismatch %llx != %llx\n" , +ksft_print_msg ("%s Q%d/%d mismatch %lx != %lx\n" , cfg->name, i /2 , i %2 , fpr_in[i], fpr_out[i]);
@@ -294,13 +294,13 @@ static int check_svcr(struct syscall_cfg *cfg, int sve_vl, int sme_vl,int errors =0 ;if (svcr_out &SVCR_SM_MASK ) { -ksft_print_msg ("%s Still in SM, SVCR %llx\n" , +ksft_print_msg ("%s Still in SM, SVCR %lx\n" , cfg->name, svcr_out); errors++; }if ((svcr_in &SVCR_ZA_MASK ) != (svcr_out &SVCR_ZA_MASK )) { -ksft_print_msg ("%s PSTATE.ZA changed, SVCR %llx != %llx\n" , +ksft_print_msg ("%s PSTATE.ZA changed, SVCR %lx != %lx\n" , cfg->name, svcr_in, svcr_out); errors++; }
Signature · 1 line
2.30.2
Will Deacon
maintainerQuoted 3 lines · Dev Jain
A "%s" is missing in
ksft_exit_fail_msg(); instead, use the newly introducedksft_exit_fail_perror(). Also,uint64_tcorresponds to unsigned 64-bit integer, so use %lx instead of %llx.
What's wrong with using %llx for a uint64_t? I think that part of the code is fine as-is.
Will
Quoted 6 lines · Will Deacon
Quoted 3 lines · Dev Jain
A "%s" is missing in
ksft_exit_fail_msg(); instead, use the newly introducedksft_exit_fail_perror(). Also,uint64_tcorresponds to unsigned 64-bit integer, so use %lx instead of %llx.What's wrong with using %llx for a
uint64_t? I think that part of the code is fine as-is.
I get a lot of warnings like these:
https://www.codedump.xyz/cpp/Zs6d7saC1IRuWV2O
Quoted 2 lines
Will
tools/testing/selftests/arm64/abi/ptrace.c static void test_hw_debug(pid_t child, int type, const char *type_name) · line 169
Quoted 6 lines · Dev Jain
tools/testing/selftests/arm64/abi/ptrace.c +2
-2-ksft_exit_fail_msg ("PTRACE_TRACEME" ,strerror (errno)); +ksft_exit_fail_perror ("PTRACE_TRACEME" );if (raise (SIGSTOP )) -ksft_exit_fail_msg ("raise(SIGSTOP)" ,strerror (errno)); +ksft_exit_fail_perror ("raise(SIGSTOP)" );
The idea with these is to include the error code as well so adding the %s would be better.
tools/testing/selftests/arm64/abi/syscall-abi.c static int check_gpr(struct syscall_cfg *cfg, int sve_vl, int sme_vl, uint64_t s · line 87
Quoted 7 lines
tools/testing/selftests/arm64/abi/syscall-abi.c +1
-1for (i =9 ; i <ARRAY_SIZE (gpr_in); i++) {if (gpr_in[i] != gpr_out[i]) { -ksft_print_msg ("%s SVE VL %d mismatch in GPR %d: %llx != %llx\n" , +ksft_print_msg ("%s SVE VL %d mismatch in GPR %d: %lx != %lx\n" , cfg->name, sve_vl, i, gpr_in[i], gpr_out[i]); errors++;
This is a different pattern of warning, it'd be easier to review if each patch only followed one pattern. There's no code overlap between the changes.
Quoted 7 lines · Will Deacon
Quoted 3 lines · Dev Jain
A "%s" is missing in
ksft_exit_fail_msg(); instead, use the newly introducedksft_exit_fail_perror(). Also,uint64_tcorresponds to unsigned 64-bit integer, so use %lx instead of %llx.What's wrong with using %llx for a
uint64_t? I think that part of the code is fine as-is.
IIRC there's some printf format specifiers specific to uint64_t which are probably a better choice here.
Quoted 10 lines · Mark Brown
tools/testing/selftests/arm64/abi/ptrace.c static void test_hw_debug(pid_t child, int type, const char *type_name) · line 169
Quoted 6 lines · Dev Jain
tools/testing/selftests/arm64/abi/ptrace.c +2
-2-ksft_exit_fail_msg ("PTRACE_TRACEME" ,strerror (errno)); +ksft_exit_fail_perror ("PTRACE_TRACEME" );if (raise (SIGSTOP )) -ksft_exit_fail_msg ("raise(SIGSTOP)" ,strerror (errno)); +ksft_exit_fail_perror ("raise(SIGSTOP)" );The idea with these is to include the error code as well so adding the %s would be better.
ksft_exit_fail_perror() can do that thing for us.
Quoted 11 lines
tools/testing/selftests/arm64/abi/syscall-abi.c static int check_gpr(struct syscall_cfg *cfg, int sve_vl, int sme_vl, uint64_t s · line 87
Quoted 8 lines
for (i = 9; i < ARRAY_SIZE(gpr_in); i++) { if (gpr_in[i] != gpr_out[i]) {tools/testing/selftests/arm64/abi/syscall-abi.c +1
-1-ksft_print_msg ("%s SVE VL %d mismatch in GPR %d: %llx != %llx\n" , +ksft_print_msg ("%s SVE VL %d mismatch in GPR %d: %lx != %lx\n" , cfg->name, sve_vl, i, gpr_in[i], gpr_out[i]); errors++;This is a different pattern of warning, it'd be easier to review if each patch only followed one pattern. There's no code overlap between the changes.
Quoted 9 lines · Mark Brown
Quoted 6 lines · Will Deacon
Quoted 3 lines · Dev Jain
A "%s" is missing in
ksft_exit_fail_msg(); instead, use the newly introducedksft_exit_fail_perror(). Also,uint64_tcorresponds to unsigned 64-bit integer, so use %lx instead of %llx.What's wrong with using %llx for a
uint64_t? I think that part of the code is fine as-is.IIRC there's some printf format specifiers specific to
uint64_twhich are probably a better choice here.
Well, then I will just send a patch fixing only the %s thing; I don't want to get lost into format specifiers right now :)
Quoted 9 lines · Dev Jain
Quoted 5 lines · Mark Brown
tools/testing/selftests/arm64/abi/ptrace.c static void test_hw_debug(pid_t child, int type, const char *type_name) · line 169
Quoted 2 lines
tools/testing/selftests/arm64/abi/ptrace.c +1
-1-ksft_exit_fail_msg ("raise(SIGSTOP)" ,strerror (errno)); +ksft_exit_fail_perror ("raise(SIGSTOP)" );The idea with these is to include the error code as well so adding the %s would be better.
ksft_exit_fail_perror()can do that thing for us.
Oh, sorry - I missed that it was changing to _perror() as well as removing the argument. Yes, that's fine.