From: Christoph Fritz Date: Tue, 3 Aug 2010 10:54:20 +0000 (+0200) Subject: wireless: ipw2100: check result of kzalloc() X-Git-Tag: v5.15~27691^2~679^2~123 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=93c0584ca92a76bd458c7fd505b1747901315156;p=mirror_ubuntu-kernels.git wireless: ipw2100: check result of kzalloc() If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is called by register_netdev. CC: Dan Carpenter Signed-off-by: Christoph Fritz Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index 5bbff4c5a489..a146240f7ddb 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;