aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorcao <[email protected]>2016-11-01 07:23:56 +0800
committerBrian Behlendorf <[email protected]>2016-10-31 16:23:56 -0700
commitb182ac00aa60d1b61d92d70ea399cd39f966fb31 (patch)
tree3e9eb864c075f5558706c4c899d0d827bedf5167 /module
parent4aafab91c5033e35217209d121f4c2fb83a8f690 (diff)
Fix coverity defects: CID 152975
CID 152975: Type:Dereference null return value Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: cao.xuewen <[email protected]> Closes #5322
Diffstat (limited to 'module')
-rw-r--r--module/zfs/dmu.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
index 7da49af7b..a817fdbce 100644
--- a/module/zfs/dmu.c
+++ b/module/zfs/dmu.c
@@ -369,12 +369,17 @@ dmu_spill_hold_by_dnode(dnode_t *dn, uint32_t flags, void *tag, dmu_buf_t **dbp)
if ((flags & DB_RF_HAVESTRUCT) == 0)
rw_exit(&dn->dn_struct_rwlock);
- ASSERT(db != NULL);
+ if (db == NULL) {
+ *dbp = NULL;
+ return (SET_ERROR(EIO));
+ }
err = dbuf_read(db, NULL, flags);
if (err == 0)
*dbp = &db->db;
- else
+ else {
dbuf_rele(db, tag);
+ *dbp = NULL;
+ }
return (err);
}