Fix coverity defects

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
This commit is contained in:
luozhengzheng 2016-09-22 09:09:00 +08:00 committed by Brian Behlendorf
parent 84347be098
commit 160987b576
3 changed files with 4 additions and 4 deletions

View File

@ -1724,7 +1724,7 @@ spa_config_valid(spa_t *spa, nvlist_t *config)
nvlist_t **child, *nv; nvlist_t **child, *nv;
uint64_t idx = 0; uint64_t idx = 0;
child = kmem_alloc(rvd->vdev_children * sizeof (nvlist_t **), child = kmem_alloc(rvd->vdev_children * sizeof (nvlist_t *),
KM_SLEEP); KM_SLEEP);
VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0); VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0);

View File

@ -691,7 +691,7 @@ zfs_fuid_info_free(zfs_fuid_info_t *fuidp)
if (fuidp->z_domain_table != NULL) if (fuidp->z_domain_table != NULL)
kmem_free(fuidp->z_domain_table, 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) { while ((zdomain = list_head(&fuidp->z_domains)) != NULL) {
list_remove(&fuidp->z_domains, zdomain); list_remove(&fuidp->z_domains, zdomain);

View File

@ -204,7 +204,7 @@ zfs_replay_fuid_domain(void *buf, void **end, uint64_t uid, uint64_t gid)
return (fuid_infop); return (fuid_infop);
fuid_infop->z_domain_table = 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); 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_cnt = domcnt;
fuid_infop->z_domain_table = 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++) { for (i = 0; i != idcnt; i++) {
zfs_fuid_t *zfuid; zfs_fuid_t *zfuid;