From f4bae2ed6361917660f5238cd35672ad18d7babc Mon Sep 17 00:00:00 2001 From: cao Date: Tue, 8 Nov 2016 06:54:32 +0800 Subject: [PATCH] Fix coverity defects: CID 147575, 147577, 147578, 147579 CID 147575, Type:Unintentional integer overflow CID 147577, Type:Unintentional integer overflow CID 147578, Type:Unintentional integer overflow CID 147579, Type:Unintentional integer overflow Reviewed-by: Brian Behlendorf Signed-off-by: cao.xuewen Closes #5365 --- lib/libzfs/libzfs_sendrecv.c | 2 +- module/zfs/dmu_tx.c | 2 +- module/zfs/dnode_sync.c | 2 +- module/zfs/metaslab.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 21d67e74d3..8926d11735 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -259,7 +259,7 @@ cksummer(void *arg) * a power of 2 if necessary. */ if (!ISP2(numbuckets)) - numbuckets = 1 << high_order_bit(numbuckets); + numbuckets = 1ULL << high_order_bit(numbuckets); ddt.dedup_hash_array = calloc(numbuckets, sizeof (dedup_entry_t *)); ddt.ddecache = umem_cache_create("dde", sizeof (dedup_entry_t), 0, diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c index 3ee9468854..f0119963ce 100644 --- a/module/zfs/dmu_tx.c +++ b/module/zfs/dmu_tx.c @@ -755,7 +755,7 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add, const char *name) * block. So there will be at most 2 blocks total, * including the header block. */ - dmu_tx_count_write(txh, 0, 2 << fzap_default_block_shift); + dmu_tx_count_write(txh, 0, 2ULL << fzap_default_block_shift); return; } diff --git a/module/zfs/dnode_sync.c b/module/zfs/dnode_sync.c index 6d1fa3339a..5277071042 100644 --- a/module/zfs/dnode_sync.c +++ b/module/zfs/dnode_sync.c @@ -292,7 +292,7 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, } /* If this whole block is free, free ourself too. */ - for (i = 0, bp = db->db.db_data; i < 1 << epbs; i++, bp++) { + for (i = 0, bp = db->db.db_data; i < 1ULL << epbs; i++, bp++) { if (!BP_IS_HOLE(bp)) break; } diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index 37fa9a7a3c..27a758ee00 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -1769,7 +1769,7 @@ metaslab_should_condense(metaslab_t *msp) range_seg_t *rs; uint64_t size, entries, segsz, object_size, optimal_size, record_size; dmu_object_info_t doi; - uint64_t vdev_blocksize = 1 << msp->ms_group->mg_vd->vdev_ashift; + uint64_t vdev_blocksize = 1ULL << msp->ms_group->mg_vd->vdev_ashift; ASSERT(MUTEX_HELD(&msp->ms_lock)); ASSERT(msp->ms_loaded);