Skip to contentSkip to conversation

helper_thread: Initialize all helper_data members before using it

PATCH Applied Bart Van Assche 2 participants 2 messages Mar 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 helper_thread: Initialize all helper_data members before using it

This patch avoids that Valgrind reports the following:

==10492== Thread 2:
==10492== Conditional jump or move depends on uninitialised value(s)

==10492==    at 0x480295: helper_thread_main (helper_thread.c:89)
==10492==    by 0x57B961A: start_thread (pthread_create.c:465)
==10492==    by 0x5CEC98E: clone (clone.S:95)
---
 helper_thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
helper_thread.c +1 -1
index 64e5a3c9d792..b05f8212a621 100644
@@ -156,7 +156,7 @@ int helper_thread_create(struct fio_mutex *startup_mutex, struct sk_out *sk_out)
 	struct helper_data *hd;
 	int ret;
 
-	hd = smalloc(sizeof(*hd));
+	hd = scalloc(1, sizeof(*hd));
 
 	setup_disk_util();
 	steadystate_setup();
Signature · 1 line
2.16.2
Applied
#1 lore raw
Quoted 7 lines · Bart Van Assche

This patch avoids that Valgrind reports the following:

==10492== Thread 2:
==10492== Conditional jump or move depends on uninitialised value(s)

==10492==    at 0x480295: helper_thread_main (helper_thread.c:89)
==10492==    by 0x57B961A: start_thread (pthread_create.c:465)
==10492==    by 0x5CEC98E: clone (clone.S:95)

Applied, thanks.

Signature · 1 line
Jens Axboe