Skip to content

Commit 583133b

Browse files
GustavoARSilvadavem330
authored andcommitted
atm: he: use 64-bit arithmetic instead of 32-bit
Add suffix ULL to constants 272, 204, 136 and 68 in order to give the compiler complete information about the proper arithmetic to use. Notice that these constants are used in contexts that expect expressions of type unsigned long long (64 bits, unsigned). The following expressions are currently being evaluated using 32-bit arithmetic: 272 * mult 204 * mult 136 * mult 68 * mult Addresses-Coverity-ID: 201058 Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4ff66ca commit 583133b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/atm/he.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,13 +738,13 @@ static int he_init_cs_block_rcm(struct he_dev *he_dev)
738738
#else
739739
/* this is pretty, but avoids _divdu3 and is mostly correct */
740740
mult = he_dev->atm_dev->link_rate / ATM_OC3_PCR;
741-
if (rate_cps > (272 * mult))
741+
if (rate_cps > (272ULL * mult))
742742
buf = 4;
743-
else if (rate_cps > (204 * mult))
743+
else if (rate_cps > (204ULL * mult))
744744
buf = 3;
745-
else if (rate_cps > (136 * mult))
745+
else if (rate_cps > (136ULL * mult))
746746
buf = 2;
747-
else if (rate_cps > (68 * mult))
747+
else if (rate_cps > (68ULL * mult))
748748
buf = 1;
749749
else
750750
buf = 0;

0 commit comments

Comments
 (0)