Skip to content

Commit f852452

Browse files
ryaotonyhutter
authored andcommitted
ZED: Fix uninitialized value reads
Coverity complained about a couple of uninitialized value reads in ZED. * zfs_deliver_dle() can pass an uninitialized string to zed_log_msg() * An uninitialized sev.sigev_signo is passed to timer_create() The former would log garbage while the latter is not a real issue, but we might as well suppress it by initializing the field to 0 for consistency's sake. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes openzfs#14047
1 parent 7d833b7 commit f852452

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

cmd/zed/agents/fmd_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ fmd_timer_install(fmd_hdl_t *hdl, void *arg, fmd_event_t *ep, hrtime_t delta)
599599
sev.sigev_notify_function = _timer_notify;
600600
sev.sigev_notify_attributes = NULL;
601601
sev.sigev_value.sival_ptr = ftp;
602+
sev.sigev_signo = 0;
602603

603604
timer_create(CLOCK_REALTIME, &sev, &ftp->ft_tid);
604605
timer_settime(ftp->ft_tid, 0, &its, NULL);

cmd/zed/agents/zfs_mod.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,7 @@ zfs_deliver_dle(nvlist_t *nvl)
11221122
strlcpy(name, devname, MAXPATHLEN);
11231123
zfs_append_partition(name, MAXPATHLEN);
11241124
} else {
1125+
sprintf(name, "unknown");
11251126
zed_log_msg(LOG_INFO, "zfs_deliver_dle: no guid or physpath");
11261127
}
11271128

0 commit comments

Comments
 (0)