linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76_init_sband_2g: null check the allocation
@ 2019-07-23 22:19 Navid Emamdoost
  2019-07-24  5:39 ` Kalle Valo
  2019-07-24 17:15 ` [PATCH] mt76_init_sband_2g: " Jakub Kicinski
  0 siblings, 2 replies; 6+ messages in thread
From: Navid Emamdoost @ 2019-07-23 22:19 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, secalert, Navid Emamdoost,
	Jakub Kicinski, Kalle Valo, David S. Miller, Matthias Brugger,
	linux-wireless, netdev, linux-arm-kernel, linux-mediatek,
	linux-kernel

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

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/net/wireless/mediatek/mt7601u/init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c b/drivers/net/wireless/mediatek/mt7601u/init.c
index 9bfac9f1d47f..cada48800928 100644
--- a/drivers/net/wireless/mediatek/mt7601u/init.c
+++ b/drivers/net/wireless/mediatek/mt7601u/init.c
@@ -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 >
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mt76_init_sband_2g: null check the allocation
  2019-07-23 22:19 [PATCH] mt76_init_sband_2g: null check the allocation Navid Emamdoost
@ 2019-07-24  5:39 ` Kalle Valo
  2019-07-24 14:17   ` [PATCH] mt7601u: " Navid Emamdoost
  2019-07-24 17:15 ` [PATCH] mt76_init_sband_2g: " Jakub Kicinski
  1 sibling, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2019-07-24  5:39 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: emamd001, kjlu, smccaman, secalert, Jakub Kicinski,
	David S. Miller, Matthias Brugger, linux-wireless, netdev,
	linux-arm-kernel, linux-mediatek, linux-kernel

Navid Emamdoost <navid.emamdoost@gmail.com> writes:

> devm_kzalloc may fail and return NULL. So the null check is needed.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
>  drivers/net/wireless/mediatek/mt7601u/init.c | 3 +++
>  1 file changed, 3 insertions(+)

The prefix in the title should be "mt7601u:".

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

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] mt7601u: null check the allocation
  2019-07-24  5:39 ` Kalle Valo
@ 2019-07-24 14:17   ` Navid Emamdoost
  2019-07-24 17:16     ` Jakub Kicinski
  2019-08-06 12:35     ` Kalle Valo
  0 siblings, 2 replies; 6+ messages in thread
From: Navid Emamdoost @ 2019-07-24 14:17 UTC (permalink / raw)
  To: kvalo
  Cc: emamd001, kjlu, smccaman, secalert, Navid Emamdoost,
	Jakub Kicinski, David S. Miller, Matthias Brugger,
	linux-wireless, netdev, linux-arm-kernel, linux-mediatek,
	linux-kernel

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

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/net/wireless/mediatek/mt7601u/init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c b/drivers/net/wireless/mediatek/mt7601u/init.c
index 9bfac9f1d47f..cada48800928 100644
--- a/drivers/net/wireless/mediatek/mt7601u/init.c
+++ b/drivers/net/wireless/mediatek/mt7601u/init.c
@@ -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 >
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mt76_init_sband_2g: null check the allocation
  2019-07-23 22:19 [PATCH] mt76_init_sband_2g: null check the allocation Navid Emamdoost
  2019-07-24  5:39 ` Kalle Valo
@ 2019-07-24 17:15 ` Jakub Kicinski
  1 sibling, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2019-07-24 17:15 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: emamd001, kjlu, smccaman, secalert, Kalle Valo, David S. Miller,
	Matthias Brugger, linux-wireless, netdev, linux-arm-kernel,
	linux-mediatek, linux-kernel

On Tue, 23 Jul 2019 17:19:54 -0500, Navid Emamdoost wrote:
> devm_kzalloc may fail and return NULL. So the null check is needed.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>

Acked-by: Jakub Kicinski <kubakici@wp.pl>

Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mt7601u: null check the allocation
  2019-07-24 14:17   ` [PATCH] mt7601u: " Navid Emamdoost
@ 2019-07-24 17:16     ` Jakub Kicinski
  2019-08-06 12:35     ` Kalle Valo
  1 sibling, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2019-07-24 17:16 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: kvalo, emamd001, kjlu, smccaman, secalert, David S. Miller,
	Matthias Brugger, linux-wireless, netdev, linux-arm-kernel,
	linux-mediatek, linux-kernel

On Wed, 24 Jul 2019 09:17:36 -0500, Navid Emamdoost wrote:
> devm_kzalloc may fail and return NULL. So the null check is needed.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>

Ah, I replied to the wrong one..

Acked-by: Jakub Kicinski <kubakici@wp.pl>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mt7601u: null check the allocation
  2019-07-24 14:17   ` [PATCH] mt7601u: " Navid Emamdoost
  2019-07-24 17:16     ` Jakub Kicinski
@ 2019-08-06 12:35     ` Kalle Valo
  1 sibling, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-08-06 12:35 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: emamd001, kjlu, smccaman, secalert, Navid Emamdoost,
	Jakub Kicinski, David S. Miller, Matthias Brugger,
	linux-wireless, netdev, linux-arm-kernel, linux-mediatek,
	linux-kernel

Navid Emamdoost <navid.emamdoost@gmail.com> wrote:

> devm_kzalloc may fail and return NULL. So the null check is needed.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> Acked-by: Jakub Kicinski <kubakici@wp.pl>

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

b95c732234fa mt7601u: null check the allocation

-- 
https://patchwork.kernel.org/patch/11057013/

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-08-06 12:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 22:19 [PATCH] mt76_init_sband_2g: null check the allocation Navid Emamdoost
2019-07-24  5:39 ` Kalle Valo
2019-07-24 14:17   ` [PATCH] mt7601u: " Navid Emamdoost
2019-07-24 17:16     ` Jakub Kicinski
2019-08-06 12:35     ` Kalle Valo
2019-07-24 17:15 ` [PATCH] mt76_init_sband_2g: " Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).