Linux brcm80211 wireless device drivers
 help / color / mirror / Atom feed
* broadcom: brcmfmac, alloc without null test
@ 2024-02-17 19:40 Joe Perches
  2024-02-18  8:26 ` Arend van Spriel
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2024-02-17 19:40 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Kalle Valo, linux-wireless, brcm80211, brcm80211-dev-list.pdl,
	LKML

There's a missing NULL alloc test here:

It doesn't appear obvious what a proper fix is.

diff -u -p ./drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c /tmp/nothing/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
--- ./drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ /tmp/nothing/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -4308,7 +4308,6 @@ brcmf_pmksa_v3_op(struct brcmf_if *ifp,
 	int ret;
 
 	pmk_op = kzalloc(sizeof(*pmk_op), GFP_KERNEL);
-	pmk_op->version = cpu_to_le16(BRCMF_PMKSA_VER_3);
 
 	if (!pmksa) {
 		/* Flush operation, operate on entire list */


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

* Re: broadcom: brcmfmac, alloc without null test
  2024-02-17 19:40 broadcom: brcmfmac, alloc without null test Joe Perches
@ 2024-02-18  8:26 ` Arend van Spriel
  0 siblings, 0 replies; 2+ messages in thread
From: Arend van Spriel @ 2024-02-18  8:26 UTC (permalink / raw)
  To: Joe Perches
  Cc: Kalle Valo, linux-wireless, brcm80211, brcm80211-dev-list.pdl,
	LKML

[-- Attachment #1: Type: text/plain, Size: 833 bytes --]

On 2/17/2024 8:40 PM, Joe Perches wrote:
> There's a missing NULL alloc test here:
> 
> It doesn't appear obvious what a proper fix is.
> 
> diff -u -p ./drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c /tmp/nothing/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> --- ./drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> +++ /tmp/nothing/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> @@ -4308,7 +4308,6 @@ brcmf_pmksa_v3_op(struct brcmf_if *ifp,
>   	int ret;
>   
>   	pmk_op = kzalloc(sizeof(*pmk_op), GFP_KERNEL);

Thanks, Joe

Looking at the callers I would say returning -ENOMEM here when pmk_op is 
NULL should do the trick.

Regards,
Arend

> -	pmk_op->version = cpu_to_le16(BRCMF_PMKSA_VER_3);
>   
>   	if (!pmksa) {
>   		/* Flush operation, operate on entire list */
> 

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]

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

end of thread, other threads:[~2024-02-18  8:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-17 19:40 broadcom: brcmfmac, alloc without null test Joe Perches
2024-02-18  8:26 ` Arend van Spriel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox