Skip to content

Commit 38264c8

Browse files
Charles Hannbd168
authored andcommitted
wifi: mt76: mt7996: Add NULL check in mt7996_thermal_init
devm_kasprintf() can return a NULL pointer on failure,but this returned value in mt7996_thermal_init() is not checked. Add NULL check in mt7996_thermal_init(), to handle kernel NULL pointer dereference error. Fixes: 69d54ce ("wifi: mt76: mt7996: switch to single multi-radio wiphy") Signed-off-by: Charles Han <hanchunchao@inspur.com> Link: https://patch.msgid.link/20250407095551.32127-1-hanchunchao@inspur.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
1 parent d57a424 commit 38264c8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • drivers/net/wireless/mediatek/mt76/mt7996

drivers/net/wireless/mediatek/mt76/mt7996/init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ static int mt7996_thermal_init(struct mt7996_phy *phy)
217217

218218
name = devm_kasprintf(&wiphy->dev, GFP_KERNEL, "mt7996_%s.%d",
219219
wiphy_name(wiphy), phy->mt76->band_idx);
220+
if (!name)
221+
return -ENOMEM;
222+
220223
snprintf(cname, sizeof(cname), "cooling_device%d", phy->mt76->band_idx);
221224

222225
cdev = thermal_cooling_device_register(name, phy, &mt7996_thermal_ops);

0 commit comments

Comments
 (0)