Skip to contentSkip to conversation

selftests: mqueue: initialize array buf before using it

PATCH New Colin Ian King 1 participant 1 message May 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: mqueue: initialize array buf before using it

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]

---
 tools/testing/selftests/mqueue/mq_perf_tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mqueue/mq_perf_tests.c +1 -1
index 5c16159d0bcd..bd561dc785d8 100644
@@ -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++)
Signature · 1 line
2.39.2