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 <behlendorf1@llnl.gov> Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14470
This commit is contained in:
parent
9a14ce43c3
commit
5cc4950901
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue