summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcao <[email protected]>2016-11-09 06:28:17 +0800
committerBrian Behlendorf <[email protected]>2016-11-08 14:28:17 -0800
commita36cc8d2428259f5cfefb653bff39ca7afc66518 (patch)
treec76a5c3dda816ad8e2194bfbb72cdda69bc5e1b9
parentffb78320c8040e10e754f1358476beb04c943510 (diff)
Fix coverity defects: CID 147626, 147628
CID 147626: Type:Dereference before null check CID 147628: Type:Dereference before null check Reviewed-by: Brian Behlendorf <[email protected] Reviewed-by: Chunwei Chen <[email protected]> Signed-off-by: cao.xuewen <[email protected]> Closes #5304
-rw-r--r--module/zfs/zfs_fm.c16
-rw-r--r--module/zfs/zfs_vnops.c3
2 files changed, 8 insertions, 11 deletions
diff --git a/module/zfs/zfs_fm.c b/module/zfs/zfs_fm.c
index df37fed2b..d2f456d17 100644
--- a/module/zfs/zfs_fm.c
+++ b/module/zfs/zfs_fm.c
@@ -272,15 +272,13 @@ zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **detector_out,
FM_EREPORT_PAYLOAD_ZFS_POOL_CONTEXT, DATA_TYPE_INT32,
spa_load_state(spa), NULL);
- if (spa != NULL) {
- fm_payload_set(ereport, FM_EREPORT_PAYLOAD_ZFS_POOL_FAILMODE,
- DATA_TYPE_STRING,
- spa_get_failmode(spa) == ZIO_FAILURE_MODE_WAIT ?
- FM_EREPORT_FAILMODE_WAIT :
- spa_get_failmode(spa) == ZIO_FAILURE_MODE_CONTINUE ?
- FM_EREPORT_FAILMODE_CONTINUE : FM_EREPORT_FAILMODE_PANIC,
- NULL);
- }
+ fm_payload_set(ereport, FM_EREPORT_PAYLOAD_ZFS_POOL_FAILMODE,
+ DATA_TYPE_STRING,
+ spa_get_failmode(spa) == ZIO_FAILURE_MODE_WAIT ?
+ FM_EREPORT_FAILMODE_WAIT :
+ spa_get_failmode(spa) == ZIO_FAILURE_MODE_CONTINUE ?
+ FM_EREPORT_FAILMODE_CONTINUE : FM_EREPORT_FAILMODE_PANIC,
+ NULL);
if (vd != NULL) {
vdev_t *pvd = vd->vdev_parent;
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index 6b5cda958..4a0f20166 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -4256,8 +4256,7 @@ zfs_putpage(struct inode *ip, struct page *pp, struct writeback_control *wbc)
* writepages() normally handles the entire commit for
* performance reasons.
*/
- if (zsb->z_log != NULL)
- zil_commit(zsb->z_log, zp->z_id);
+ zil_commit(zsb->z_log, zp->z_id);
}
ZFS_EXIT(zsb);