aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2023-02-07 04:51:56 -0500
committerBrian Behlendorf <[email protected]>2023-02-28 17:31:50 -0800
commit5cc49509013db4aa23f8e21eafdbde8403d5dffa (patch)
tree28634a7f99adb87bbc96058d2182f26e0b2e369b /module/zfs
parent9a14ce43c3d6a9939804215bbbe66de5115ace42 (diff)
Suppress static analyzer warning in dbuf_hold_copy()
Clang's static analyzer claims that dbuf_hold_copy() will have a NULL pointer dereference in data->b_data when called by dbuf_hold_impl(). This is impossible because data is dr->dt.dl.dr_data, which is non-NULL whenever db->db_level == 0, which is always the case whenever dbuf_hold_impl() calls dbuf_hold_copy(). We add an assertion to suppress the complaint. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Brian Atkinson <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14470
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/dbuf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c
index efaa13317..160557fce 100644
--- a/module/zfs/dbuf.c
+++ b/module/zfs/dbuf.c
@@ -3632,8 +3632,10 @@ dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid,
dn->dn_object != DMU_META_DNODE_OBJECT &&
db->db_state == DB_CACHED && db->db_data_pending) {
dbuf_dirty_record_t *dr = db->db_data_pending;
- if (dr->dt.dl.dr_data == db->db_buf)
+ if (dr->dt.dl.dr_data == db->db_buf) {
+ ASSERT3P(db->db_buf, !=, NULL);
dbuf_hold_copy(dn, db);
+ }
}
if (multilist_link_active(&db->db_cache_link)) {