Commit 2ee4e27c authored by Dan Carpenter's avatar Dan Carpenter Committed by John W. Linville

ipw2200: check for allocation failures

If kzalloc() fails then return should return with -ENOMEM.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 9eba6125
...@@ -11470,6 +11470,10 @@ static int ipw_net_init(struct net_device *dev) ...@@ -11470,6 +11470,10 @@ static int ipw_net_init(struct net_device *dev)
bg_band->channels = bg_band->channels =
kzalloc(geo->bg_channels * kzalloc(geo->bg_channels *
sizeof(struct ieee80211_channel), GFP_KERNEL); sizeof(struct ieee80211_channel), GFP_KERNEL);
if (!bg_band->channels) {
rc = -ENOMEM;
goto out;
}
/* translate geo->bg to bg_band.channels */ /* translate geo->bg to bg_band.channels */
for (i = 0; i < geo->bg_channels; i++) { for (i = 0; i < geo->bg_channels; i++) {
bg_band->channels[i].band = IEEE80211_BAND_2GHZ; bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
...@@ -11505,6 +11509,10 @@ static int ipw_net_init(struct net_device *dev) ...@@ -11505,6 +11509,10 @@ static int ipw_net_init(struct net_device *dev)
a_band->channels = a_band->channels =
kzalloc(geo->a_channels * kzalloc(geo->a_channels *
sizeof(struct ieee80211_channel), GFP_KERNEL); sizeof(struct ieee80211_channel), GFP_KERNEL);
if (!a_band->channels) {
rc = -ENOMEM;
goto out;
}
/* translate geo->bg to a_band.channels */ /* translate geo->bg to a_band.channels */
for (i = 0; i < geo->a_channels; i++) { for (i = 0; i < geo->a_channels; i++) {
a_band->channels[i].band = IEEE80211_BAND_2GHZ; a_band->channels[i].band = IEEE80211_BAND_2GHZ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment