diff options
author | cao <[email protected]> | 2016-10-01 06:56:17 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-09-30 15:56:17 -0700 |
commit | 0a8f18f9327a6275759393c5fc2f14664f172add (patch) | |
tree | c01629706eaec056f824038ddca0763a974f306c /module/zfs/dsl_dataset.c | |
parent | 470f12d631764d3706e2702762e9f3ae924cab43 (diff) |
Fix coverity defects: CID 147563, 147560
coverity scan CID:147563, Type:dereference null return value
coverity scan CID:147560, Type:dereference null return value
Reviewed-by: Richard Laager <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: cao.xuewen <[email protected]>
Closes #5168
Diffstat (limited to 'module/zfs/dsl_dataset.c')
-rw-r--r-- | module/zfs/dsl_dataset.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index d4a3a9e41..3026d8733 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -2354,6 +2354,10 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx) } snap = list_head(&ddpa->shared_snaps); + if (snap == NULL) { + err = SET_ERROR(ENOENT); + goto out; + } origin_ds = snap->ds; /* compute origin's new unique space */ @@ -2462,6 +2466,10 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx) * iterate over all bps. */ snap = list_head(&ddpa->origin_snaps); + if (snap == NULL) { + err = SET_ERROR(ENOENT); + goto out; + } err = snaplist_space(&ddpa->shared_snaps, snap->ds->ds_dir->dd_origin_txg, &ddpa->cloneusedsnap); if (err != 0) |