summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2020-02-11 13:12:41 -0800
committerGitHub <[email protected]>2020-02-11 13:12:41 -0800
commit7b49bbc8164a8a5cd31cf1ba7a6cd88269fec8d0 (patch)
tree28532fa83856c46ebfeb64d01e88b84dea50acea /module
parentdceeca5bbd00188e7dcb1cf66080dcf2a0b47601 (diff)
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 <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9962
Diffstat (limited to 'module')
-rw-r--r--module/zfs/dbuf.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c
index 0256f3a4c..bafc30e62 100644
--- a/module/zfs/dbuf.c
+++ b/module/zfs/dbuf.c
@@ -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;
uint64_t txg = tx->tx_txg;
avl_index_t where;
+ dbuf_dirty_record_t *dr;
if (end_blkid > dn->dn_maxblkid &&
!(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 */
- if (!list_is_empty(&db->db_dirty_records)) {
- dbuf_dirty_record_t *dr;
-
- dr = list_head(&db->db_dirty_records);
+ dr = list_head(&db->db_dirty_records);
+ if (dr != NULL) {
if (dr->dr_txg == txg) {
/*
* 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;
dr = list_head(&db->db_dirty_records);
+ /* dirty record added by dmu_buf_will_dirty() */
+ VERIFY(dr != NULL);
if (db->db_level == 0)
dr->dt.dl.dr_data = buf;
ASSERT3U(dr->dr_txg, ==, tx->tx_txg);