atm: he: use 64-bit arithmetic instead of 32-bit

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/583133b35ecaea84590e92e2732d1a472747ca7d
Commit:     583133b35ecaea84590e92e2732d1a472747ca7d
Parent:     4ff66cae7f10b65b028dc3bdaaad9cc2989ef6ae
Refname:    refs/heads/master
Author:     Gustavo A. R. Silva <[email protected]>
AuthorDate: Wed Feb 7 10:17:29 2018 -0600
Committer:  David S. Miller <[email protected]>
CommitDate: Thu Feb 8 15:05:16 2018 -0500

    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]>
---
 drivers/atm/he.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index e58538c29377..29f102dcfec4 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -738,13 +738,13 @@ static int he_init_cs_block_rcm(struct he_dev *he_dev)
 #else
 		/* this is pretty, but avoids _divdu3 and is mostly correct */
 		mult = he_dev->atm_dev->link_rate / ATM_OC3_PCR;
-		if (rate_cps > (272 * mult))
+		if (rate_cps > (272ULL * mult))
 			buf = 4;
-		else if (rate_cps > (204 * mult))
+		else if (rate_cps > (204ULL * mult))
 			buf = 3;
-		else if (rate_cps > (136 * mult))
+		else if (rate_cps > (136ULL * mult))
 			buf = 2;
-		else if (rate_cps > (68 * mult))
+		else if (rate_cps > (68ULL * mult))
 			buf = 1;
 		else
 			buf = 0;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.