mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-27 08:00:11 +00:00
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 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
0ca9f1d4a3
commit
b9ca419a21
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user