]> granicus.if.org Git - zfs/commitdiff
Fix coverity defects
authorluozhengzheng <luo.zhengzheng@zte.com.cn>
Thu, 22 Sep 2016 01:09:00 +0000 (09:09 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 22 Sep 2016 01:09:00 +0000 (18:09 -0700)
coverity scan CID:147633,type: sizeof not portable
coverity scan CID:147637,type: sizeof not portable
coverity scan CID:147638,type: sizeof not portable
coverity scan CID:147640,type: sizeof not portable

In these particular cases sizeof (XX **) happens to be equal to sizeof (X *),
but this is not a portable assumption.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: luozhengzheng <luo.zhengzheng@zte.com.cn>
Closes #5144

module/zfs/spa.c
module/zfs/zfs_fuid.c
module/zfs/zfs_replay.c

index c7cfe6ee8e988e9f731a65ef68d204268ced9fe9..3264bfb10054f55e776dee985090a6832397bb92 100644 (file)
@@ -1724,7 +1724,7 @@ spa_config_valid(spa_t *spa, nvlist_t *config)
                nvlist_t **child, *nv;
                uint64_t idx = 0;
 
-               child = kmem_alloc(rvd->vdev_children * sizeof (nvlist_t **),
+               child = kmem_alloc(rvd->vdev_children * sizeof (nvlist_t *),
                    KM_SLEEP);
                VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0);
 
index 93b7a8b841102f2640be540b99b5c1a4d1b681b9..3ab1c7ba03f5652601ec2204b9b0d68384a88112 100644 (file)
@@ -691,7 +691,7 @@ zfs_fuid_info_free(zfs_fuid_info_t *fuidp)
 
        if (fuidp->z_domain_table != NULL)
                kmem_free(fuidp->z_domain_table,
-                   (sizeof (char **)) * fuidp->z_domain_cnt);
+                   (sizeof (char *)) * fuidp->z_domain_cnt);
 
        while ((zdomain = list_head(&fuidp->z_domains)) != NULL) {
                list_remove(&fuidp->z_domains, zdomain);
index b631ba65b96c76287bd22345df7a26d8e00a8b57..eee13c0651a296918b474d58a6560c8598862766 100644 (file)
@@ -204,7 +204,7 @@ zfs_replay_fuid_domain(void *buf, void **end, uint64_t uid, uint64_t gid)
                return (fuid_infop);
 
        fuid_infop->z_domain_table =
-           kmem_zalloc(domcnt * sizeof (char **), KM_SLEEP);
+           kmem_zalloc(domcnt * sizeof (char *), KM_SLEEP);
 
        zfs_replay_fuid_ugid(fuid_infop, uid, gid);
 
@@ -228,7 +228,7 @@ zfs_replay_fuids(void *start, void **end, int idcnt, int domcnt, uint64_t uid,
        fuid_infop->z_domain_cnt = domcnt;
 
        fuid_infop->z_domain_table =
-           kmem_zalloc(domcnt * sizeof (char **), KM_SLEEP);
+           kmem_zalloc(domcnt * sizeof (char *), KM_SLEEP);
 
        for (i = 0; i != idcnt; i++) {
                zfs_fuid_t *zfuid;