Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v5] tools/testing:Fix the wrong format specifier
@ 2024-07-26  2:32 Zhu Jun
  2024-07-26  8:30 ` [PATCH v5] tools/testing: Fix " Markus Elfring
  2024-07-26 17:32 ` [PATCH v5] tools/testing:Fix " Shuah Khan
  0 siblings, 2 replies; 3+ messages in thread
From: Zhu Jun @ 2024-07-26  2:32 UTC (permalink / raw)
  To: zhang.lyra; +Cc: shuah, kees, luto, wad, linux-kselftest, linux-kernel, zhujun2

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.
v4->v5:
	Compile the kernel for testing using make


 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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v5] tools/testing: Fix the wrong format specifier
  2024-07-26  2:32 [PATCH v5] tools/testing:Fix the wrong format specifier Zhu Jun
@ 2024-07-26  8:30 ` Markus Elfring
  2024-07-26 17:32 ` [PATCH v5] tools/testing:Fix " Shuah Khan
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2024-07-26  8:30 UTC (permalink / raw)
  To: Zhu Jun, linux-kselftest, Chunyan Zhang
  Cc: LKML, Andy Lutomirski, Kees Cook, Shuah Khan, Will Drewry

> The format specifier in fprintf is "%u", that "%u" should use
> unsigned int type instead.

* Please improve the change description with imperative wordings.
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10#n94

* Would you like to add any tags (like “Fixes” and “Cc”) accordingly?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10#n145

* How good does the summary phrase fit to your proposal?


>                           the problem is discovered by reading code.

How do you think about to detect such change possibilities by more systematic
source code analyses?

Regards,
Markus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v5] tools/testing:Fix the wrong format specifier
  2024-07-26  2:32 [PATCH v5] tools/testing:Fix the wrong format specifier Zhu Jun
  2024-07-26  8:30 ` [PATCH v5] tools/testing: Fix " Markus Elfring
@ 2024-07-26 17:32 ` Shuah Khan
  1 sibling, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2024-07-26 17:32 UTC (permalink / raw)
  To: Zhu Jun, zhang.lyra
  Cc: shuah, kees, luto, wad, linux-kselftest, linux-kernel, Shuah Khan

On 7/25/24 20:32, 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.

I am asking you to send the v2 change with updated change log
to show how this change is tested.

> v4->v5:
> 	Compile the kernel for testing using make

Running make isn't sufficient - please verify running the tests
making sure there are no regressions. Since you are changing the
harness, you want to make sure this change You are changing the
harness.

> 
> 
>   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;

I am asking you to send the v2 change with updated change log
to show how this change is tested.
		fprintf(TH_LOG_STREAM,
-			"# %s: Test ended in some other way [%u]\n",
+			"# %s: Test ended in some other way [%d]\n",
  			t->name,

%d makes sense here in this message.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-26 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26  2:32 [PATCH v5] tools/testing:Fix the wrong format specifier Zhu Jun
2024-07-26  8:30 ` [PATCH v5] tools/testing: Fix " Markus Elfring
2024-07-26 17:32 ` [PATCH v5] tools/testing:Fix " Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox