From patchwork Mon Oct 4 12:31:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 228491 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o94CWBeO008651 for ; Mon, 4 Oct 2010 12:32:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755692Ab0JDMcI (ORCPT ); Mon, 4 Oct 2010 08:32:08 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:54264 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755686Ab0JDMcH (ORCPT ); Mon, 4 Oct 2010 08:32:07 -0400 Received: by wwj40 with SMTP id 40so4019063wwj.1 for ; Mon, 04 Oct 2010 05:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=8azgZE4nnx/OuHox/fnvjp8qduCrMGeaSp3rdS2PSjw=; b=FaEFY8wXlP0NBFyR7hb0cgJGXUlZd9NfjAnGb3+ravKrBRspBuxdsfnB10tudyFPEJ hZ3LmxTWQltWAI3wLlC/2XiBeYSvEOyCMfmwnoKw+JPGNjfP6ypzL4l0gS6eaN2pyPA2 7nS1bgK355odfSMRhVKpaoAhq5iaVTaVVOrPE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=p8nvYRMjifMQbFYsJFH3JMqQZCS6AX/KY7A8erolrQiH2l5H97j3RcaiPPq7MfaAOR 9dCChD8SEG9fPJnaNzvKyOP6cTtLCV65SEVvBbLIAMhJplqCawnqaF6h8n/77Ehj75xE k9wBqXngkJ7+qs5zU3F9rKfC1xgoW8HqPIklc= Received: by 10.216.131.161 with SMTP id m33mr7637661wei.13.1286195525717; Mon, 04 Oct 2010 05:32:05 -0700 (PDT) Received: from bicker (h3f03.n1.ips.mtn.co.ug [41.210.191.3]) by mx.google.com with ESMTPS id p45sm2932587weq.45.2010.10.04.05.32.01 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 04 Oct 2010 05:32:04 -0700 (PDT) Date: Mon, 4 Oct 2010 14:31:46 +0200 From: Dan Carpenter To: "John W. Linville" Cc: Zhu Yi , "David S. Miller" , linux-wireless@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch -next] ipw2200: check for allocation failures Message-ID: <20101004123146.GC5692@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 04 Oct 2010 12:32:11 +0000 (UTC) diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index cb2552a..d04d760 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;