linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning
@ 2020-10-26 21:29 Arnd Bergmann
  2020-10-26 21:29 ` [PATCH net-next 02/11] net: hostap: fix function cast warning Arnd Bergmann
                   ` (11 more replies)
  0 siblings, 12 replies; 34+ messages in thread
From: Arnd Bergmann @ 2020-10-26 21:29 UTC (permalink / raw)
  To: Chas Williams
  Cc: Arnd Bergmann, Nathan Chancellor, Nick Desaulniers,
	David S. Miller, linux-atm-general, netdev, linux-kernel,
	clang-built-linux

From: Arnd Bergmann <arnd@arndb.de>

Building a "W=1" kernel with clang produces a warning about
suspicous pointer arithmetic:

drivers/atm/horizon.c:1844:52: warning: performing pointer arithmetic
on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
  for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem)

The way that the addresses are handled is very obscure, and
rewriting it to be more conventional seems fairly pointless, given
that this driver probably has no users.
Shut up this warning by adding a cast to uintptr_t.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/atm/horizon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index 4f2951cbe69c..cd368786b216 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -1841,7 +1841,7 @@ static int hrz_init(hrz_dev *dev)
   
   printk (" clearing memory");
   
-  for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem)
+  for (mem = (HDW *) memmap; mem < (HDW *) ((uintptr_t)memmap + 1); ++mem)
     wr_mem (dev, mem, 0);
   
   printk (" tx channels");
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2020-11-10 18:14 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 21:29 [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning Arnd Bergmann
2020-10-26 21:29 ` [PATCH net-next 02/11] net: hostap: fix function cast warning Arnd Bergmann
2020-11-07 11:37   ` Kalle Valo
2020-10-26 21:29 ` [PATCH net-next 03/11] rsxx: remove extraneous 'const' qualifier Arnd Bergmann
2020-10-29 19:34   ` Nick Desaulniers
2020-10-29 21:35     ` Joe Perches
2020-10-26 21:29 ` [PATCH net-next 04/11] wimax: fix duplicate initializer warning Arnd Bergmann
2020-10-27  7:22   ` Johannes Berg
2020-10-27 11:51     ` Arnd Bergmann
2020-10-27 14:51       ` Perez-Gonzalez, Inaky
2020-10-26 21:29 ` [PATCH net-next 05/11] wimax/i2400m/control: fix enum warning Arnd Bergmann
2020-10-26 21:29 ` [PATCH net-next 06/11] rtlwifi: fix -Wpointer-sign warning Arnd Bergmann
2020-10-27  1:29   ` Pkshih
2020-10-26 21:29 ` [PATCH net-next 07/11] rtw88: remove extraneous 'const' qualifier Arnd Bergmann
2020-10-27  1:49   ` Nathan Chancellor
2020-10-26 21:29 ` [PATCH net-next 08/11] ath9k: work around false-positive gcc warning Arnd Bergmann
2020-11-02 16:26   ` Kalle Valo
2020-11-02 17:59     ` Johannes Berg
2020-11-02 22:29       ` Arnd Bergmann
2020-11-07 11:18       ` Kalle Valo
2020-11-07 11:36         ` Arnd Bergmann
2020-11-10 18:13   ` Kalle Valo
2020-10-26 21:29 ` [PATCH net-next 09/11] ath6kl: fix enum-conversion warning Arnd Bergmann
2020-10-27  6:15   ` Kalle Valo
2020-11-07  8:08   ` Kalle Valo
2020-10-26 21:29 ` [PATCH net-next 10/11] ch_ktls: " Arnd Bergmann
2020-10-26 21:42   ` Andrew Lunn
2020-10-26 21:29 ` [PATCH net-next 11/11] ipv6: fix type mismatch warning Arnd Bergmann
2020-10-27  3:55 ` [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning Xie He
2020-10-27  4:02   ` Xie He
2020-10-27 13:23     ` Arnd Bergmann
2020-10-27 21:46       ` Xie He
2020-10-28  0:42 ` Jakub Kicinski
2020-10-28  8:35   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).