aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed/zed.d/statechange-notify.sh
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2022-12-12 13:40:05 -0500
committerGitHub <[email protected]>2022-12-12 10:40:05 -0800
commitd31a7cb4fa59c7a2ff39cd091643c18617b601c1 (patch)
tree7f147b3a9cfde1ad501efca3279b311c26b53bea /cmd/zed/zed.d/statechange-notify.sh
parent786ff6a6cb33226b4f4292c7569b9093286f74d9 (diff)
Address theoretical uninitialized variable usage in zstream
Coverity has long complained about the checksum being uninitialized if an END record is processed before its BEGIN record. This should not happen, but there was no code to check for it. I had left this unfixed since it was a low priority issue, but then 9f4ede63d23be4f43ba8dd0ca42c6a773a8eaa8d added another instance of this. I am making an effort to "hold the line" to keep new coverity defect reports from going unaddressed, so I find myself forced to fix this much earlier than I had originally planned to address it. The solution is to maintain a counter and a flag. Then use VERIFY statements to verify the following runtime constraints: * Every record either has a corresponding BEGIN record, is a BEGIN record or is the end of stream END record for replication streams. * BEGIN records cannot be nested. i.e. There must be an END record before another BEGIN record may be seen. Failure to meet these constraints will cause the program to exit. This is sufficient to ensure that the checksum is never accessed when uninitialized. Reported-by: Coverity (CID 1524578) Reported-by: Coverity (CID 1524633) Reported-by: Coverity (CID 1527295) Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Damian Szuberski <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14176
Diffstat (limited to 'cmd/zed/zed.d/statechange-notify.sh')
0 files changed, 0 insertions, 0 deletions