Skip to content

Commit

Permalink
Fix multiplication converted to larger type
Browse files Browse the repository at this point in the history
This fixes the instances of the "Multiplication result converted to 
larger type" alert that codeQL scanning found.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Andrew Innes <andrew.c12@gmail.com>
Closes openzfs#14094
  • Loading branch information
andrewc12 authored and shodanshok committed Oct 30, 2022
1 parent dd00a39 commit 15b9bb4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/raidz_test/raidz_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/libefi/rdwr_efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions tests/zfs-tests/cmd/stride_dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 15b9bb4

Please sign in to comment.