diff options
author | Mark Johnston <markj@FreeBSD.org> | 2021-07-13 21:45:49 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2021-07-27 01:46:45 +0000 |
commit | b88a1996e2185b462f63108e96dd6f4226e8c7f6 (patch) | |
tree | b204cf80861a727405bf91130d8ea2dea532c93d /sys | |
parent | 97880418422475bc35c2485074ac77912f202305 (diff) | |
download | src-b88a1996e2185b462f63108e96dd6f4226e8c7f6.tar.gz src-b88a1996e2185b462f63108e96dd6f4226e8c7f6.zip |
fifo: Explicitly initialize generation numbers when opening
The fi_rgen and fi_wgen fields are generation numbers used when sleeping
waiting for the other end of the fifo to be opened. The fields were not
explicitly initialized after allocation, but this was harmless. To
avoid false positives from KMSAN, though, ensure that they get
initialized to zero.
Reported by: KMSAN
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b9ca419a21d109948bf0fcea5c59725f1fe0cd7b)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/fs/fifofs/fifo_vnops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 33c2c8ab2951..d2a51de84fba 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -154,9 +154,9 @@ fifo_open(ap) error = pipe_named_ctor(&fpipe, td); if (error != 0) return (error); - fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK); + fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK | M_ZERO); fip->fi_pipe = fpipe; - fpipe->pipe_wgen = fip->fi_readers = fip->fi_writers = 0; + fpipe->pipe_wgen = 0; KASSERT(vp->v_fifoinfo == NULL, ("fifo_open: v_fifoinfo race")); vp->v_fifoinfo = fip; } |