linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Christoph Fritz <chf.fritz@googlemail.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	kernel-janitors <kernel-janitors@vger.kernel.org>,
	Zhu Yi <yi.zhu@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Reinette Chatre <reinette.chatre@intel.com>,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] wireless: ipw2100: check result of kzalloc()
Date: Tue, 3 Aug 2010 10:17:01 +0200	[thread overview]
Message-ID: <20100803081701.GP26313@bicker> (raw)
In-Reply-To: <1280797822.11158.55.camel@lovely.krouter>

On Tue, Aug 03, 2010 at 03:10:22AM +0200, Christoph Fritz wrote:
> If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is
> called by register_netdev.
> 
> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
> ---
>  drivers/net/wireless/ipw2x00/ipw2100.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
> index 0bd4dfa..908c176 100644
> --- a/drivers/net/wireless/ipw2x00/ipw2100.c
> +++ b/drivers/net/wireless/ipw2x00/ipw2100.c
> @@ -1924,6 +1924,8 @@ 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)

There should be an "ipw2100_down(priv);" on the error path here.

> +			return -ENOMEM;
>  		/* translate geo->bg to bg_band.channels */

regards,
dan carpenter



  reply	other threads:[~2010-08-03  8:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03  1:10 [PATCH] wireless: ipw2100: check result of kzalloc() Christoph Fritz
2010-08-03  8:17 ` Dan Carpenter [this message]
2010-08-03 10:28   ` Christoph Fritz
2010-08-03 10:54     ` [PATCH v2] " Christoph Fritz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100803081701.GP26313@bicker \
    --to=error27@gmail.com \
    --cc=chf.fritz@googlemail.com \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=reinette.chatre@intel.com \
    --cc=yi.zhu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).