Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Gustavo A. R. Silva and committed by
David S. Miller
583133b3 4ff66cae

+4 -4
+4 -4
drivers/atm/he.c
··· 738 738 #else 739 739 /* this is pretty, but avoids _divdu3 and is mostly correct */ 740 740 mult = he_dev->atm_dev->link_rate / ATM_OC3_PCR; 741 - if (rate_cps > (272 * mult)) 741 + if (rate_cps > (272ULL * mult)) 742 742 buf = 4; 743 - else if (rate_cps > (204 * mult)) 743 + else if (rate_cps > (204ULL * mult)) 744 744 buf = 3; 745 - else if (rate_cps > (136 * mult)) 745 + else if (rate_cps > (136ULL * mult)) 746 746 buf = 2; 747 - else if (rate_cps > (68 * mult)) 747 + else if (rate_cps > (68ULL * mult)) 748 748 buf = 1; 749 749 else 750 750 buf = 0;