From b182ac00aa60d1b61d92d70ea399cd39f966fb31 Mon Sep 17 00:00:00 2001 From: cao Date: Tue, 1 Nov 2016 07:23:56 +0800 Subject: [PATCH] Fix coverity defects: CID 152975 CID 152975: Type:Dereference null return value Reviewed-by: Brian Behlendorf Signed-off-by: cao.xuewen Closes #5322 --- module/zfs/dmu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index 7da49af7b5f1..a817fdbcefe1 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); }