From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: kvalo@codeaurora.org
Cc: emamd001@umn.edu, kjlu@umn.edu, smccaman@umn.edu,
secalert@redhat.com, Navid Emamdoost <navid.emamdoost@gmail.com>,
Jakub Kicinski <kubakici@wp.pl>,
"David S. Miller" <davem@davemloft.net>,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mt7601u: null check the allocation
Date: Wed, 24 Jul 2019 09:17:36 -0500 [thread overview]
Message-ID: <20190724141736.29994-1-navid.emamdoost@gmail.com> (raw)
In-Reply-To: <87d0i00z4t.fsf@kamboji.qca.qualcomm.com>
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
next prev parent reply other threads:[~2019-07-24 14:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Navid Emamdoost [this message]
2019-07-24 17:16 ` [PATCH] mt7601u: " Jakub Kicinski
2019-08-06 12:35 ` Kalle Valo
2019-07-24 17:15 ` [PATCH] mt76_init_sband_2g: " Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190724141736.29994-1-navid.emamdoost@gmail.com \
--to=navid.emamdoost@gmail.com \
--cc=davem@davemloft.net \
--cc=emamd001@umn.edu \
--cc=kjlu@umn.edu \
--cc=kubakici@wp.pl \
--cc=kvalo@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=secalert@redhat.com \
--cc=smccaman@umn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).