mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/futex: Fix -Wformat-security warnings in futex_priv_hash
@ 2025-09-05 15:17 Sukrut Heroorkar
  2025-09-05 15:20 ` André Almeida
  0 siblings, 1 reply; 3+ messages in thread
From: Sukrut Heroorkar @ 2025-09-05 15:17 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Peter Zijlstra, Darren Hart,
	Davidlohr Bueso, André Almeida, Shuah Khan,
	Sebastian Andrzej Siewior, Colin Ian King, Sukrut Heroorkar,
	open list:FUTEX SUBSYSTEM, open list:KERNEL SELFTEST FRAMEWORK
  Cc: skhan, david.hunter.linux

Fix several -Wformat-security warnings in futex_priv_hash by passing
the test message strings as arguments to %s format specifiers in
ksft_*() logging functions.

This silences the warnings without changing the functional behavior
of the test.

Signed-off-by: Sukrut Heroorkar <hsukrut3@gmail.com>
---
 .../selftests/futex/functional/futex_priv_hash.c       | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/futex/functional/futex_priv_hash.c b/tools/testing/selftests/futex/functional/futex_priv_hash.c
index aea001ac4946..2627eeb1625f 100644
--- a/tools/testing/selftests/futex/functional/futex_priv_hash.c
+++ b/tools/testing/selftests/futex/functional/futex_priv_hash.c
@@ -193,10 +193,10 @@ int main(int argc, char *argv[])
 	futex_slots1 = futex_hash_slots_get();
 	if (futex_slots1 <= 0) {
 		ksft_print_msg("Current hash buckets: %d\n", futex_slots1);
-		ksft_exit_fail_msg(test_msg_auto_create);
+		ksft_exit_fail_msg("%s", test_msg_auto_create);
 	}
 
-	ksft_test_result_pass(test_msg_auto_create);
+	ksft_test_result_pass("%s", test_msg_auto_create);
 
 	online_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 	ret = pthread_barrier_init(&barrier_main, NULL, MAX_THREADS + 1);
@@ -237,11 +237,11 @@ int main(int argc, char *argv[])
 			}
 			ksft_print_msg("Expected increase of hash buckets but got: %d -> %d\n",
 				       futex_slots1, futex_slotsn);
-			ksft_exit_fail_msg(test_msg_auto_inc);
+			ksft_exit_fail_msg("%s", test_msg_auto_inc);
 		}
-		ksft_test_result_pass(test_msg_auto_inc);
+		ksft_test_result_pass("%s", test_msg_auto_inc);
 	} else {
-		ksft_test_result_skip(test_msg_auto_inc);
+		ksft_test_result_skip("%s", test_msg_auto_inc);
 	}
 	ret = pthread_mutex_unlock(&global_lock);
 
-- 
2.43.0


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

* Re: [PATCH] selftests/futex: Fix -Wformat-security warnings in futex_priv_hash
  2025-09-05 15:17 [PATCH] selftests/futex: Fix -Wformat-security warnings in futex_priv_hash Sukrut Heroorkar
@ 2025-09-05 15:20 ` André Almeida
  2025-09-05 15:25   ` sukrut heroorkar
  0 siblings, 1 reply; 3+ messages in thread
From: André Almeida @ 2025-09-05 15:20 UTC (permalink / raw)
  To: Sukrut Heroorkar
  Cc: open list:KERNEL SELFTEST FRAMEWORK, Shuah Khan, Davidlohr Bueso,
	Thomas Gleixner, Colin Ian King, Sebastian Andrzej Siewior,
	open list:FUTEX SUBSYSTEM, Ingo Molnar, skhan,
	david.hunter.linux, Peter Zijlstra, Darren Hart

Hi Sukrut,

Em 05/09/2025 12:17, Sukrut Heroorkar escreveu:
> Fix several -Wformat-security warnings in futex_priv_hash by passing
> the test message strings as arguments to %s format specifiers in
> ksft_*() logging functions.
> 
> This silences the warnings without changing the functional behavior
> of the test.
> 
>
This is already fixed upstream:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=locking/futex&id=f8ef9c24029c85cd0328a9c668283017d8c292ad

https://lore.kernel.org/all/20250827130011.677600-4-bigeasy@linutronix.de/

Thanks,
	 André

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

* Re: [PATCH] selftests/futex: Fix -Wformat-security warnings in futex_priv_hash
  2025-09-05 15:20 ` André Almeida
@ 2025-09-05 15:25   ` sukrut heroorkar
  0 siblings, 0 replies; 3+ messages in thread
From: sukrut heroorkar @ 2025-09-05 15:25 UTC (permalink / raw)
  To: André Almeida
  Cc: open list:KERNEL SELFTEST FRAMEWORK, Shuah Khan, Davidlohr Bueso,
	Thomas Gleixner, Colin Ian King, Sebastian Andrzej Siewior,
	open list:FUTEX SUBSYSTEM, Ingo Molnar, skhan,
	david.hunter.linux, Peter Zijlstra, Darren Hart

Hi André,

On Fri, Sep 5, 2025 at 5:21 PM André Almeida <andrealmeid@igalia.com> wrote:
>
> Hi Sukrut,
>
> Em 05/09/2025 12:17, Sukrut Heroorkar escreveu:
> > Fix several -Wformat-security warnings in futex_priv_hash by passing
> > the test message strings as arguments to %s format specifiers in
> > ksft_*() logging functions.
> >
> > This silences the warnings without changing the functional behavior
> > of the test.
> >
> >
> This is already fixed upstream:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=locking/futex&id=f8ef9c24029c85cd0328a9c668283017d8c292ad
>
> https://lore.kernel.org/all/20250827130011.677600-4-bigeasy@linutronix.de/
>
> Thanks,
>          André


Thanks for pointing this out.

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

end of thread, other threads:[~2025-09-05 15:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-05 15:17 [PATCH] selftests/futex: Fix -Wformat-security warnings in futex_priv_hash Sukrut Heroorkar
2025-09-05 15:20 ` André Almeida
2025-09-05 15:25   ` sukrut heroorkar

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®