From: Christoph Fritz <chf.fritz@googlemail.com>
To: Dan Carpenter <error27@gmail.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
kernel-janitors <kernel-janitors@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Reinette Chatre <reinette.chatre@intel.com>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH v2] wireless: ipw2100: check result of kzalloc()
Date: Tue, 03 Aug 2010 12:54:20 +0200 [thread overview]
Message-ID: <1280832860.3034.35.camel@lovely.krouter> (raw)
In-Reply-To: <1280831322.3034.7.camel@lovely.krouter>
If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is
called by register_netdev.
CC: Dan Carpenter <error27@gmail.com>
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
drivers/net/wireless/ipw2x00/ipw2100.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 0bd4dfa..cbec02a 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -1924,6 +1924,10 @@ static int ipw2100_net_init(struct net_device *dev)
bg_band->channels =
kzalloc(geo->bg_channels *
sizeof(struct ieee80211_channel), GFP_KERNEL);
+ if (!bg_band->channels) {
+ ipw2100_down(priv);
+ return -ENOMEM;
+ }
/* translate geo->bg to bg_band.channels */
for (i = 0; i < geo->bg_channels; i++) {
bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
--
1.7.1
prev parent reply other threads:[~2010-08-03 10:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-03 1:10 [PATCH] wireless: ipw2100: check result of kzalloc() Christoph Fritz
2010-08-03 8:17 ` Dan Carpenter
2010-08-03 10:28 ` Christoph Fritz
2010-08-03 10:54 ` Christoph Fritz [this message]
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=1280832860.3034.35.camel@lovely.krouter \
--to=chf.fritz@googlemail.com \
--cc=davem@davemloft.net \
--cc=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=reinette.chatre@intel.com \
/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).