mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next] selftests: mqueue: initialize array buf before using it
@ 2024-05-23 10:56 Colin Ian King
  0 siblings, 0 replies; only message in thread
From: Colin Ian King @ 2024-05-23 10:56 UTC (permalink / raw)
  To: Shuah Khan, linux-kselftest; +Cc: kernel-janitors, linux-kernel

Currently array buf is not being initialized and so garbage values
on the stack are being used in the mq_send calls. Initialize the
values in the array to zero.

Cleans up cppcheck warning:
mq_perf_tests.c:334:25: error: Uninitialized variable: buff [uninitvar]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 tools/testing/selftests/mqueue/mq_perf_tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c
index 5c16159d0bcd..bd561dc785d8 100644
--- a/tools/testing/selftests/mqueue/mq_perf_tests.c
+++ b/tools/testing/selftests/mqueue/mq_perf_tests.c
@@ -322,7 +322,7 @@ void *fake_cont_thread(void *arg)
 
 void *cont_thread(void *arg)
 {
-	char buff[MSG_SIZE];
+	char buff[MSG_SIZE] = { };
 	int i, priority;
 
 	for (i = 0; i < num_cpus_to_pin; i++)
-- 
2.39.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-23 10:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-23 10:56 [PATCH][next] selftests: mqueue: initialize array buf before using it Colin Ian King

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®