diff options
author | Dan Carpenter <error27@gmail.com> | 2010-10-04 14:31:46 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-05 13:35:29 -0400 |
commit | 2ee4e27cf25ab647137713ca16377d8d9e138ea2 (patch) | |
tree | 32a064fbd7cc4086d320a0889936aa4a3f5560aa /drivers/net/wireless | |
parent | 9eba612549f575d7dccda672ce932e15e7392d83 (diff) | |
download | talos-op-linux-2ee4e27cf25ab647137713ca16377d8d9e138ea2.tar.gz talos-op-linux-2ee4e27cf25ab647137713ca16377d8d9e138ea2.zip |
ipw2200: check for allocation failures
If kzalloc() fails then return should return with -ENOMEM.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ipw2x00/ipw2200.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index cb2552a6777c..d04d76082777 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c @@ -11470,6 +11470,10 @@ static int ipw_net_init(struct net_device *dev) bg_band->channels = kzalloc(geo->bg_channels * sizeof(struct ieee80211_channel), GFP_KERNEL); + if (!bg_band->channels) { + rc = -ENOMEM; + goto out; + } /* translate geo->bg to bg_band.channels */ for (i = 0; i < geo->bg_channels; i++) { bg_band->channels[i].band = IEEE80211_BAND_2GHZ; @@ -11505,6 +11509,10 @@ static int ipw_net_init(struct net_device *dev) a_band->channels = kzalloc(geo->a_channels * sizeof(struct ieee80211_channel), GFP_KERNEL); + if (!a_band->channels) { + rc = -ENOMEM; + goto out; + } /* translate geo->bg to a_band.channels */ for (i = 0; i < geo->a_channels; i++) { a_band->channels[i].band = IEEE80211_BAND_2GHZ; |