[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200828071125.GA18772@gondor.apana.org.au>
Date: Fri, 28 Aug 2020 17:11:25 +1000
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Joerg Roedel <joerg.roedel@....com>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Subject: [PATCH] kernel.h: Silence sparse warning in lower_32_bits
I keep getting sparse warnings in crypto such as:
CHECK ../drivers/crypto/ccree/cc_hash.c
../drivers/crypto/ccree/cc_hash.c:49:9: warning: cast truncates bits from constant value (47b5481dbefa4fa4 becomes befa4fa4)
../drivers/crypto/ccree/cc_hash.c:49:26: warning: cast truncates bits from constant value (db0c2e0d64f98fa7 becomes 64f98fa7)
../drivers/crypto/ccree/cc_hash.c:49:43: warning: cast truncates bits from constant value (8eb44a8768581511 becomes 68581511)
../drivers/crypto/ccree/cc_hash.c:49:60: warning: cast truncates bits from constant value (67332667ffc00b31 becomes ffc00b31)
../drivers/crypto/ccree/cc_hash.c:50:9: warning: cast truncates bits from constant value (152fecd8f70e5939 becomes f70e5939)
../drivers/crypto/ccree/cc_hash.c:50:26: warning: cast truncates bits from constant value (9159015a3070dd17 becomes 3070dd17)
../drivers/crypto/ccree/cc_hash.c:50:43: warning: cast truncates bits from constant value (629a292a367cd507 becomes 367cd507)
../drivers/crypto/ccree/cc_hash.c:50:60: warning: cast truncates bits from constant value (cbbb9d5dc1059ed8 becomes c1059ed8)
../drivers/crypto/ccree/cc_hash.c:52:9: warning: cast truncates bits from constant value (5be0cd19137e2179 becomes 137e2179)
../drivers/crypto/ccree/cc_hash.c:52:26: warning: cast truncates bits from constant value (1f83d9abfb41bd6b becomes fb41bd6b)
../drivers/crypto/ccree/cc_hash.c:52:43: warning: cast truncates bits from constant value (9b05688c2b3e6c1f becomes 2b3e6c1f)
../drivers/crypto/ccree/cc_hash.c:52:60: warning: cast truncates bits from constant value (510e527fade682d1 becomes ade682d1)
../drivers/crypto/ccree/cc_hash.c:53:9: warning: cast truncates bits from constant value (a54ff53a5f1d36f1 becomes 5f1d36f1)
../drivers/crypto/ccree/cc_hash.c:53:26: warning: cast truncates bits from constant value (3c6ef372fe94f82b becomes fe94f82b)
../drivers/crypto/ccree/cc_hash.c:53:43: warning: cast truncates bits from constant value (bb67ae8584caa73b becomes 84caa73b)
../drivers/crypto/ccree/cc_hash.c:53:60: warning: cast truncates bits from constant value (6a09e667f3bcc908 becomes f3bcc908)
This patch removes the warning by adding a mask to keep sparse
happy.
Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 500def620d8f..c25b8e41c0ea 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -186,7 +186,7 @@
* lower_32_bits - return bits 0-31 of a number
* @n: the number we're accessing
*/
-#define lower_32_bits(n) ((u32)(n))
+#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
struct completion;
struct pt_regs;
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists