[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250331103543.9154-1-bsdhenrymartin@gmail.com>
Date: Mon, 31 Mar 2025 18:35:43 +0800
From: Henry Martin <bsdhenrymartin@...il.com>
To: nbd@....name,
lorenzo@...nel.org,
ryder.lee@...iatek.com
Cc: shayne.chen@...iatek.com,
sean.wang@...iatek.com,
matthias.bgg@...il.com,
angelogioacchino.delregno@...labora.com,
howard-yh.hsu@...iatek.com,
StanleyYP.Wang@...iatek.com,
chui-hao.chiu@...iatek.com,
linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Henry Martin <bsdhenrymartin@...il.com>
Subject: [PATCH] wifi: mt76: mt7996: Add NULL check in mt7996_thermal_init
When devm_kasprintf() fails, it returns a NULL pointer. However, this return value is not properly checked in the function mt7996_thermal_init.
A NULL check should be added after the devm_kasprintf() to prevent potential NULL pointer dereference error.
Fixes: 69d54ce7491d0 ("switch to single multi-radio wiphy")
Signed-off-by: Henry Martin <bsdhenrymartin@...il.com>
---
drivers/net/wireless/mediatek/mt76/mt7996/init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
index 6b660424aedc..702447022f0e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
@@ -217,6 +217,8 @@ static int mt7996_thermal_init(struct mt7996_phy *phy)
name = devm_kasprintf(&wiphy->dev, GFP_KERNEL, "mt7996_%s.%d",
wiphy_name(wiphy), phy->mt76->band_idx);
+ if (!name)
+ return -ENOMEM;
snprintf(cname, sizeof(cname), "cooling_device%d", phy->mt76->band_idx);
cdev = thermal_cooling_device_register(name, phy, &mt7996_thermal_ops);
--
2.34.1
Powered by blists - more mailing lists