]> git.proxmox.com Git - mirror_zfs.git/commit
Suppress Clang Static Analyzer warning in dbuf_dnode_findbp()
authorRichard Yao <richard.yao@alumni.stonybrook.edu>
Sat, 4 Mar 2023 21:11:49 +0000 (16:11 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 8 Mar 2023 21:51:36 +0000 (13:51 -0800)
commitf9e109223ba06690d3318ee352dc75d45ce88e2e
tree3c55489df4f6ca6c2fb7427369a9ab892da94d02
parent399bb816070500e7c784e14198a2209bf083b4e9
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
module/zfs/dbuf.c