[lvc-project] [PATCH v2] brcmsmac: add NULL pointer check in wlc_phy_radio_init_2057

Dmitriy Okunev dmitriy.okunev at red-soft.ru
Wed Jul 29 13:13:00 MSK 2026


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)
-- 
2.53.0




More information about the lvc-project mailing list