diff options
author | Andrew Innes <[email protected]> | 2022-10-29 00:30:37 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2022-10-28 09:30:37 -0700 |
commit | e09fdda9775d47078a9dff9d958faf25cf8ca9e8 (patch) | |
tree | 9eb7907be8fda1bd8b6a3b068dd54aaf7f8bcacb | |
parent | 5d0fd8429b0257b2dcd80cef9ed13c8293c1060d (diff) |
Fix multiplication converted to larger type
This fixes the instances of the "Multiplication result converted to
larger type" alert that codeQL scanning found.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Richard Yao <[email protected]>
Signed-off-by: Andrew Innes <[email protected]>
Closes #14094
-rw-r--r-- | cmd/raidz_test/raidz_test.c | 2 | ||||
-rw-r--r-- | lib/libefi/rdwr_efi.c | 2 | ||||
-rw-r--r-- | module/zfs/arc.c | 2 | ||||
-rw-r--r-- | tests/zfs-tests/cmd/stride_dd.c | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/cmd/raidz_test/raidz_test.c b/cmd/raidz_test/raidz_test.c index 34f3f6f1c..195026d3a 100644 --- a/cmd/raidz_test/raidz_test.c +++ b/cmd/raidz_test/raidz_test.c @@ -937,7 +937,7 @@ run_sweep(void) opts = umem_zalloc(sizeof (raidz_test_opts_t), UMEM_NOFAIL); opts->rto_ashift = ashift_v[a]; opts->rto_dcols = dcols_v[d]; - opts->rto_offset = (1 << ashift_v[a]) * rand(); + opts->rto_offset = (1ULL << ashift_v[a]) * rand(); opts->rto_dsize = size_v[s]; opts->rto_expand = rto_opts.rto_expand; opts->rto_expand_offset = rto_opts.rto_expand_offset; diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c index 3501c3ea3..739219e04 100644 --- a/lib/libefi/rdwr_efi.c +++ b/lib/libefi/rdwr_efi.c @@ -1362,7 +1362,7 @@ efi_write(int fd, struct dk_gpt *vtoc) if (NBLOCKS(vtoc->efi_nparts, vtoc->efi_lbasize) < 34) { dk_ioc.dki_length = EFI_MIN_ARRAY_SIZE + vtoc->efi_lbasize; } else { - dk_ioc.dki_length = NBLOCKS(vtoc->efi_nparts, + dk_ioc.dki_length = (len_t)NBLOCKS(vtoc->efi_nparts, vtoc->efi_lbasize) * vtoc->efi_lbasize; } diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 54cfb4bd3..936bcb5e3 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -5136,7 +5136,7 @@ arc_adapt(int bytes, arc_state_t *state) if (!zfs_arc_p_dampener_disable) mult = MIN(mult, 10); /* avoid wild arc_p adjustment */ - arc_p = MIN(arc_c - arc_p_min, arc_p + bytes * mult); + arc_p = MIN(arc_c - arc_p_min, arc_p + (uint64_t)bytes * mult); } else if (state == arc_mfu_ghost) { uint64_t delta; diff --git a/tests/zfs-tests/cmd/stride_dd.c b/tests/zfs-tests/cmd/stride_dd.c index 732ac9f47..a20b26131 100644 --- a/tests/zfs-tests/cmd/stride_dd.c +++ b/tests/zfs-tests/cmd/stride_dd.c @@ -25,8 +25,8 @@ static int bsize = 0; static int count = 0; static char *ifile = NULL; static char *ofile = NULL; -static int stride = 0; -static int seek = 0; +static off_t stride = 0; +static off_t seek = 0; static const char *execname = "stride_dd"; static void usage(void); |