mwifiex: avoid null-pointer-subtraction warning
authorArnd Bergmann <arnd@arndb.de>
Mon, 27 Sep 2021 12:16:35 +0000 (14:16 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 28 Sep 2021 14:42:26 +0000 (17:42 +0300)
commit603a1621caa097be23c7784e36cb8edf23cd31db
tree02d1b573ff16df691cfd77aa3ed746b957eefca7
parent151a7c12c4fc8340b51e849e4d1fcb7d794777a5
mwifiex: avoid null-pointer-subtraction warning

clang complains about some NULL pointer arithmetic in this driver:

drivers/net/wireless/marvell/mwifiex/sta_tx.c:65:59: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
        pad = ((void *)skb->data - (sizeof(*local_tx_pd) + hroom)-
                                                                 ^
drivers/net/wireless/marvell/mwifiex/uap_txrx.c:478:53: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
        pad = ((void *)skb->data - (sizeof(*txpd) + hroom) - NULL) &

Rework that expression to do the same thing using a uintptr_t.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210927121656.940304-1-arnd@kernel.org
drivers/net/wireless/marvell/mwifiex/sta_tx.c
drivers/net/wireless/marvell/mwifiex/uap_txrx.c