linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wireless: ipw2100: check result of kzalloc()
@ 2010-08-03  1:10 Christoph Fritz
  2010-08-03  8:17 ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Fritz @ 2010-08-03  1:10 UTC (permalink / raw)
  To: John W. Linville
  Cc: kernel-janitors, Zhu Yi, David S. Miller, Reinette Chatre,
	linux-wireless

If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is
called by register_netdev.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
 drivers/net/wireless/ipw2x00/ipw2100.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 0bd4dfa..908c176 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -1924,6 +1924,8 @@ 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)
+			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




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

end of thread, other threads:[~2010-08-03 10:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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     ` [PATCH v2] " Christoph Fritz

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).