mwifiex: avoid null-pointer-subtraction warning
Subsystems (3)
PATCH 1/1 mwifiex: avoid null-pointer-subtraction warning
From: Arnd Bergmann <[email protected]>
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.
--- drivers/net/wireless/marvell/mwifiex/sta_tx.c | 4 ++-- drivers/net/wireless/marvell/mwifiex/uap_txrx.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/marvell/mwifiex/sta_tx.c +2 -2
@@ -62,8 +62,8 @@ void *mwifiex_process_sta_txpd(struct mwifiex_private *priv, pkt_type =mwifiex_is_skb_mgmt_frame (skb) ?PKT_TYPE_MGMT :0 ; - pad = ((void *)skb->data - (sizeof (*local_tx_pd) + hroom)- -NULL ) & (MWIFIEX_DMA_ALIGN_SZ -1 ); + pad = ((uintptr_t )skb->data - (sizeof (*local_tx_pd) + hroom)) & + (MWIFIEX_DMA_ALIGN_SZ -1 );skb_push (skb,sizeof (*local_tx_pd) + pad); local_tx_pd = (struct txpd *) skb->data;
drivers/net/wireless/marvell/mwifiex/uap_txrx.c +2 -2
@@ -475,8 +475,8 @@ void *mwifiex_process_uap_txpd(struct mwifiex_private *priv, pkt_type =mwifiex_is_skb_mgmt_frame (skb) ?PKT_TYPE_MGMT :0 ; - pad = ((void *)skb->data - (sizeof (*txpd) + hroom) -NULL ) & - (MWIFIEX_DMA_ALIGN_SZ -1 ); + pad = ((uintptr_t )skb->data - (sizeof (*txpd) + hroom)) & + (MWIFIEX_DMA_ALIGN_SZ -1 );skb_push (skb,sizeof (*txpd) + pad);
Signature · 1 line
2.29.2
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
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]
Quoted 8 lines
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 <[email protected]>
I'll queue this to v5.15.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
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]
Quoted 8 lines
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 <[email protected]>
Patch applied to wireless-drivers.git, thanks.
603a1621caa0 mwifiex: avoid null-pointer-subtraction warning
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
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]
Quoted 8 lines
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 <[email protected]>
Patch applied to wireless-drivers.git, thanks.
603a1621caa0 mwifiex: avoid null-pointer-subtraction warning
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches