diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2022-08-12 00:33:00 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2022-08-12 00:33:00 +0000 |
commit | c3896ca15192f55fd4674fe10f62fb8efa36327f (patch) | |
tree | 7e534ae998649fe06fb7beab7dcbea4188941556 | |
parent | 0facb5359c1ef6c6a17f7ecd9a1a4cb6c465a605 (diff) |
Coverity says multiplying two uint32_t's and assigning them to
a uint64_t may not produce the (humanly) obvious result.
Cast one of them to a (uint64_t) in the hope of invoking the
appropriate int promotion god.
CID 1519495
-rw-r--r-- | sys/kern/subr_disk.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 90bdd46d7a7..7f65013eb8a 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.250 2022/08/11 20:22:27 krw Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.251 2022/08/12 00:32:59 krw Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -515,7 +515,8 @@ gpt_get_parts(struct buf *bp, void (*strat)(struct buf *), struct disklabel *lp, partnum = letoh32(gh->gh_part_num); partsize = letoh32(gh->gh_part_size); - sectors = (partnum * partsize + lp->d_secsize - 1) / lp->d_secsize; + sectors = ((uint64_t)partnum * partsize + lp->d_secsize - 1) / + lp->d_secsize; ngp = mallocarray(sectors, lp->d_secsize, M_DEVBUF, M_NOWAIT | M_ZERO); if (ngp == NULL) { |