Suppress clang static analyzer warning in vdev_stat_update()
63652e1546
added unnecessary branches in
`vdev_stat_update()` to suppress an ASAN false positive the breaks
ztest. This had the downside of causing false positive reports in both
Coverity and Clang's static analyzer. vd is never NULL, so we add a
preprocessor check to only apply the workaround when compiling with ASAN
support.
Reported-by: Coverity (CID-1524583)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14575
This commit is contained in:
parent
37edc7ea98
commit
950980b4c4
|
@ -4700,8 +4700,14 @@ vdev_stat_update(zio_t *zio, uint64_t psize)
|
|||
vdev_t *vd = zio->io_vd ? zio->io_vd : rvd;
|
||||
vdev_t *pvd;
|
||||
uint64_t txg = zio->io_txg;
|
||||
/* Suppress ASAN false positive */
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
vdev_stat_t *vs = vd ? &vd->vdev_stat : NULL;
|
||||
vdev_stat_ex_t *vsx = vd ? &vd->vdev_stat_ex : NULL;
|
||||
#else
|
||||
vdev_stat_t *vs = &vd->vdev_stat;
|
||||
vdev_stat_ex_t *vsx = &vd->vdev_stat_ex;
|
||||
#endif
|
||||
zio_type_t type = zio->io_type;
|
||||
int flags = zio->io_flags;
|
||||
|
||||
|
|
Loading…
Reference in New Issue