Fix possible NULL pointer dereference in dbuf_verify()
Coverity reported a dereference after a NULL check in dbuf_verify(). If `dn` is `NULL`, we can just assume that !dn->dn_free_txg, so we change `!dn->dn_free_txg` to `(dn == NULL || !dn->dn_free_txg)`. Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reported-by: Coverity (CID-992298) Closes #14619
This commit is contained in:
parent
3a03c96381
commit
3cb293a6f8
|
@ -1157,7 +1157,7 @@ dbuf_verify(dmu_buf_impl_t *db)
|
|||
if ((db->db_blkptr == NULL || BP_IS_HOLE(db->db_blkptr)) &&
|
||||
(db->db_buf == NULL || db->db_buf->b_data) &&
|
||||
db->db.db_data && db->db_blkid != DMU_BONUS_BLKID &&
|
||||
db->db_state != DB_FILL && !dn->dn_free_txg) {
|
||||
db->db_state != DB_FILL && (dn == NULL || !dn->dn_free_txg)) {
|
||||
/*
|
||||
* If the blkptr isn't set but they have nonzero data,
|
||||
* it had better be dirty, otherwise we'll lose that
|
||||
|
|
Loading…
Reference in New Issue