Address Coverity warnings in #9902

Coverity reports the variable may be NULL, but due to the
way the dirty records are handled this cannot be the case.
Add a comment and VERIFY to make this clear and silence
the warning.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #9962
This commit is contained in:
Matthew Macy 2020-02-11 13:12:41 -08:00 committed by GitHub
parent dceeca5bbd
commit 7b49bbc816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -1737,6 +1737,7 @@ dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid,
dmu_buf_impl_t *db, *db_next; dmu_buf_impl_t *db, *db_next;
uint64_t txg = tx->tx_txg; uint64_t txg = tx->tx_txg;
avl_index_t where; avl_index_t where;
dbuf_dirty_record_t *dr;
if (end_blkid > dn->dn_maxblkid && if (end_blkid > dn->dn_maxblkid &&
!(start_blkid == DMU_SPILL_BLKID || end_blkid == DMU_SPILL_BLKID)) !(start_blkid == DMU_SPILL_BLKID || end_blkid == DMU_SPILL_BLKID))
@ -1790,10 +1791,8 @@ dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid,
} }
/* The dbuf is referenced */ /* The dbuf is referenced */
if (!list_is_empty(&db->db_dirty_records)) { dr = list_head(&db->db_dirty_records);
dbuf_dirty_record_t *dr; if (dr != NULL) {
dr = list_head(&db->db_dirty_records);
if (dr->dr_txg == txg) { if (dr->dr_txg == txg) {
/* /*
* This buffer is "in-use", re-adjust the file * This buffer is "in-use", re-adjust the file
@ -1867,6 +1866,8 @@ dbuf_new_size(dmu_buf_impl_t *db, int size, dmu_tx_t *tx)
db->db.db_size = size; db->db.db_size = size;
dr = list_head(&db->db_dirty_records); dr = list_head(&db->db_dirty_records);
/* dirty record added by dmu_buf_will_dirty() */
VERIFY(dr != NULL);
if (db->db_level == 0) if (db->db_level == 0)
dr->dt.dl.dr_data = buf; dr->dt.dl.dr_data = buf;
ASSERT3U(dr->dr_txg, ==, tx->tx_txg); ASSERT3U(dr->dr_txg, ==, tx->tx_txg);