Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93c0584c authored by Christoph Fritz's avatar Christoph Fritz Committed by John W. Linville
Browse files

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 <error27@gmail.com>
Signed-off-by: default avatarChristoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c8f3b721
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;