HomeFreeBSD

Suppress Clang Static Analyzer warning in dbuf_dnode_findbp()

Description

Suppress Clang Static Analyzer warning in dbuf_dnode_findbp()

Clang's static analyzer reports that if a blkid == DMU_SPILL_BLKID is
passed, then we can have a NULL pointer dereference when either
->dn_have_spill or DNODE_FLAG_SPILL_BLKPTR is not set. This should not
happen. We add an ASSERT() to suppress reports about NULL pointer
dereferences.

Originally, I wanted to use one or two IMPLY statements on
pre-conditions before the call to dbuf_findbp(), but Clang's static
analyzer did not understand it.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14575

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Mar 4 2023, 9:11 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Mar 8 2023, 9:51 PM
Parents
rG399bb8160705: Suppress Clang Static Analyzer warning in vdev_split()
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGf9e109223ba0: Suppress Clang Static Analyzer warning in dbuf_dnode_findbp() (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Mar 8 2023, 9:51 PM