[PATCH v4] tools/testing:Fix the wrong format specifier

Zhu Jun posted 1 patch 1 year, 6 months ago
There is a newer version of this series
tools/testing/selftests/kselftest_harness.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v4] tools/testing:Fix the wrong format specifier
Posted by Zhu Jun 1 year, 6 months ago
The format specifier in fprintf is "%u", that "%u" should use
unsigned int type instead.the problem is discovered by reading code.

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
 v1->v2:
 	modify commit info add how to find the problem in the log
 v2->v3:
 	Seems this can use macro WTERMSIG like those above usage, rather than
 	changing the print format.
 v3->v4:
 	Now the commit summary doesn't match the change you are making.
	 Also WTERMSIG() is incorrect for this conditional code path.
	 See comments below in the code path.

	 I would leave the v2 code intact. How are you testing this change?
	 Please include the details in the change log.


 tools/testing/selftests/kselftest_harness.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index e05ac8261046..675b8f43e148 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -910,7 +910,7 @@ void __wait_for_test(struct __test_metadata *t)
 		.sa_flags = SA_SIGINFO,
 	};
 	struct sigaction saved_action;
-	int status;
+	unsigned int status;
 
 	if (sigaction(SIGALRM, &action, &saved_action)) {
 		t->passed = 0;
-- 
2.17.1
Re: [PATCH v4] tools/testing:Fix the wrong format specifier
Posted by Shuah Khan 1 year, 6 months ago
On 7/24/24 20:34, Zhu Jun wrote:
> The format specifier in fprintf is "%u", that "%u" should use
> unsigned int type instead.the problem is discovered by reading code.
> 
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
> ---
>   v1->v2:
>   	modify commit info add how to find the problem in the log
>   v2->v3:
>   	Seems this can use macro WTERMSIG like those above usage, rather than
>   	changing the print format.
>   v3->v4:
>   	Now the commit summary doesn't match the change you are making.
> 	 Also WTERMSIG() is incorrect for this conditional code path.
> 	 See comments below in the code path.
> 
> 	 I would leave the v2 code intact. How are you testing this change?
> 	 Please include the details in the change log.
> 
> 
>   tools/testing/selftests/kselftest_harness.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
> index e05ac8261046..675b8f43e148 100644
> --- a/tools/testing/selftests/kselftest_harness.h
> +++ b/tools/testing/selftests/kselftest_harness.h
> @@ -910,7 +910,7 @@ void __wait_for_test(struct __test_metadata *t)
>   		.sa_flags = SA_SIGINFO,
>   	};
>   	struct sigaction saved_action;
> -	int status;
> +	unsigned int status;

This change is different from what the subject line says and
what was in your v2. Also you didn't tell me how you tested
this.

Sorry I have to nack this patch.

thanks,
-- Shuah