[lvc-project] [PATCH] brcmsmac: add NULL pointer check in wlc_phy_radio_init_2057
Dmitriy Okunev
dmitriy.okunev at red-soft.ru
Wed Jul 29 13:18:20 MSK 2026
This is an old version with a typo (pi->pubri instead
pi->pubpi). Please ignore it; the corrected v2 has been sent.
29.07.2026 10:40, Dmitriy Okunev пишет:
> Pointer regs_2057_ptr may remain NULL if the device reports unsupported
> phy/radio revisions. This could lead to NULL dereference. Add a check to prevent it.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Dmitriy Okunev<dmitriy.okunev at red-soft.ru>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
> index 86cfa3e87a04..54a2a704e86c 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
> @@ -19760,7 +19760,10 @@ static void wlc_phy_radio_init_2057(struct brcms_phy *pi)
> }
> }
>
> - wlc_phy_init_radio_regs_allbands(pi, regs_2057_ptr);
> + if(regs_2057_ptr)
> + wlc_phy_init_radio_regs_allbands(pi, regs_2057_ptr);
> + else
> + pr_err("%s: Unsupported radio registers for phy rev %d, radio rev %d\n", __func__, pi->pubri.phy_rev, pi->pubri.radiorev);
> }
>
> static u16 wlc_phy_radio205x_rcal(struct brcms_phy *pi)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://linuxtesting.org/pipermail/lvc-project/attachments/20260729/4c4ea359/attachment.html>
More information about the lvc-project
mailing list