diff options
author | Richard Yao <[email protected]> | 2023-03-04 16:11:49 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2023-03-08 13:51:36 -0800 |
commit | f9e109223ba06690d3318ee352dc75d45ce88e2e (patch) | |
tree | 3c55489df4f6ca6c2fb7427369a9ab892da94d02 /module/zfs/dbuf.c | |
parent | 399bb816070500e7c784e14198a2209bf083b4e9 (diff) |
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 <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #14575
Diffstat (limited to 'module/zfs/dbuf.c')
-rw-r--r-- | module/zfs/dbuf.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 427aab508..f1d2f61e7 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -3187,6 +3187,7 @@ dbuf_dnode_findbp(dnode_t *dn, uint64_t level, uint64_t blkid, err = dbuf_findbp(dn, level, blkid, B_FALSE, &dbp, &bp2); if (err == 0) { + ASSERT3P(bp2, !=, NULL); *bp = *bp2; if (dbp != NULL) dbuf_rele(dbp, NULL); |