]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit3f83b29985d87714dfa6ae6139f457a5952ad055
tree02d1b573ff16df691cfd77aa3ed746b957eefca7
parent42d7090062e18cf54a96c45b04e845715116c69c
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