Skip to contentSkip to conversation

mt76_init_sband_2g: null check the allocation

PATCH In review Navid Emamdoost 3 participants 7 messages Jul 23, 2019 – Aug 6, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mt76_init_sband_2g: null check the allocation

devm_kzalloc may fail and return NULL. So the null check is needed.

---
 drivers/net/wireless/mediatek/mt7601u/init.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt7601u/init.c +3 -0
index 9bfac9f1d47f..cada48800928 100644
@@ -557,6 +557,9 @@ mt76_init_sband_2g(struct mt7601u_dev *dev)
 {
 	dev->sband_2g = devm_kzalloc(dev->dev, sizeof(*dev->sband_2g),
 				     GFP_KERNEL);
+	if (!dev->sband_2g)
+		return -ENOMEM;
+
 	dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = dev->sband_2g;
 
 	WARN_ON(dev->ee->reg.start - 1 + dev->ee->reg.num >
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/1 mt7601u: null check the allocation

devm_kzalloc may fail and return NULL. So the null check is needed.

---
 drivers/net/wireless/mediatek/mt7601u/init.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt7601u/init.c +3 -0
index 9bfac9f1d47f..cada48800928 100644
@@ -557,6 +557,9 @@ mt76_init_sband_2g(struct mt7601u_dev *dev)
 {
 	dev->sband_2g = devm_kzalloc(dev->dev, sizeof(*dev->sband_2g),
 				     GFP_KERNEL);
+	if (!dev->sband_2g)
+		return -ENOMEM;
+
 	dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = dev->sband_2g;
 
 	WARN_ON(dev->ee->reg.start - 1 + dev->ee->reg.num >
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH] mt7601u: null check the allocation

In reply to Navid Emamdoost
Quoted 4 lines · Navid Emamdoost

devm_kzalloc may fail and return NULL. So the null check is needed.

Patch applied to wireless-drivers-next.git, thanks.

b95c732234fa mt7601u: null check the allocation

Signature · 3 lines
https://patchwork.kernel.org/patch/11057013/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#5 lore raw

Re: [PATCH] mt7601u: null check the allocation

In reply to Navid Emamdoost
Quoted 4 lines · Navid Emamdoost

devm_kzalloc may fail and return NULL. So the null check is needed.

Patch applied to wireless-drivers-next.git, thanks.

b95c732234fa mt7601u: null check the allocation

Signature · 3 lines
https://patchwork.kernel.org/patch/11057013/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches