Skip to content

Commit

Permalink
ipw2200: check for allocation failures
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and John W. Linville committed Oct 5, 2010
1 parent 9eba612 commit 2ee4e27
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/wireless/ipw2x00/ipw2200.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2ee4e27

Please sign in to comment.