event-notifier: Initialize `_notifier_notification` struct to zero
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 14 Dec 2020 19:56:19 +0000 (14:56 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 15 Dec 2020 15:19:20 +0000 (10:19 -0500)
Valgrind reports the following use of uninitialized bytes:

  ==2233138== Syscall param writev(vector[...]) points to uninitialised byte(s)
  ==2233138==    at 0x4EA161D: __writev (writev.c:26)
  ==2233138==    by 0x4EA161D: writev (writev.c:24)
  ==2233138==    by 0x489A9EC: patient_writev (in /usr/local/lib/liblttng-ust.so.0.0.0)
  ==2233138==    by 0x48C2D5F: lttng_event_notifier_notification_send (in /usr/local/lib/liblttng-ust.so.0.0.0)
  ==2233138==    by 0x4033F3: __event_notifier_probe__tp___tptest (in /home/frdeso/projets/lttng/tools/tests/utils/testapp/gen-ust-events/gen-ust-events)
  ==2233138==    by 0x401D6E: main (in /home/frdeso/projets/lttng/tools/tests/utils/testapp/gen-ust-events/gen-ust-events)
  ==2233138==  Address 0x1ffeffedda is on thread 1's stack
  ==2233138==  in frame #2, created by lttng_event_notifier_notification_send (???:)
  ==2233138==

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I49ac4b440df61b322ac9614b09c32d1f69beedd0

liblttng-ust/event-notifier-notification.c

index ed2c8d28ae217823acace539b5d3e9c777d816c6..5bbbbd31064a6743a2b2d7b2119d704a4c063f28 100644 (file)
@@ -315,7 +315,7 @@ void notification_send(struct lttng_event_notifier_notification *notif,
        ssize_t ret;
        size_t content_len;
        int iovec_count = 1;
-       struct lttng_ust_event_notifier_notification ust_notif;
+       struct lttng_ust_event_notifier_notification ust_notif = {0};
        struct iovec iov[2];
 
        assert(notif);
This page took 0.028864 seconds and 4 git commands to generate.