Message ID | 7658242ceef838cc553cb3bbb63ede20d1bf9cb5.camel@perches.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Kalle Valo |
Headers | show |
Series | broadcom: brcmfmac, alloc without null test | expand |
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 */ >
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 */