Skip to content

Commit

Permalink
Fix coverity defects
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: luozhengzheng <[email protected]>
Closes #5144
  • Loading branch information
luozhengzheng authored and behlendorf committed Sep 22, 2016
1 parent 84347be commit 160987b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion module/zfs/zfs_fuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions module/zfs/zfs_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down

0 comments on commit 160987b

Please sign in to comment.