]> granicus.if.org Git - zfs/commitdiff
Fix coverity defects: CID 147626, 147628
authorcao <cao.xuewen@zte.com.cn>
Tue, 8 Nov 2016 22:28:17 +0000 (06:28 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 8 Nov 2016 22:28:17 +0000 (14:28 -0800)
CID 147626: Type:Dereference before null check
CID 147628: Type:Dereference before null check

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov
Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn>
Closes #5304

module/zfs/zfs_fm.c
module/zfs/zfs_vnops.c

index df37fed2b9729742eb4f83bf76f84e472a40e39f..d2f456d1747118a89fdb4e1775a1f1b293871102 100644 (file)
@@ -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;
index 6b5cda95820c33c77206cdbb2b380b753d9792a3..4a0f201660708f8d7844af9872887069cf0c88f1 100644 (file)
@@ -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);