All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: "Bounine, Alexandre" <Alexandre.Bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] rapidio: potential null deref on failure path
Date: Mon, 21 Mar 2011 14:59:48 +0000	[thread overview]
Message-ID: <20110321145948.GP2008@bicker> (raw)
In-Reply-To: <0CE8B6BE3C4AD74AB97D9D29BD24E55201A588F5@CORPEXCH1.na.ads.idt.com>

On Mon, Mar 21, 2011 at 05:49:06AM -0700, Bounine, Alexandre wrote:
> Better to combine both conditions:
> 
> if (rio_is_switch(rdev) && rswitch->route_table))
>  		kfree(rswitch->route_table);
> 
> Because there is situation when routine fails to allocate route_table
> for a switch.
> 

kfree() accepts NULL pointers.  People have been removing these checks
all over the tree by the hundreds...  Sorry I should have mentioned 
that.

regards,
dan carpenter



WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: "Bounine, Alexandre" <Alexandre.Bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] rapidio: potential null deref on failure path
Date: Mon, 21 Mar 2011 17:59:48 +0300	[thread overview]
Message-ID: <20110321145948.GP2008@bicker> (raw)
In-Reply-To: <0CE8B6BE3C4AD74AB97D9D29BD24E55201A588F5@CORPEXCH1.na.ads.idt.com>

On Mon, Mar 21, 2011 at 05:49:06AM -0700, Bounine, Alexandre wrote:
> Better to combine both conditions:
> 
> if (rio_is_switch(rdev) && rswitch->route_table))
>  		kfree(rswitch->route_table);
> 
> Because there is situation when routine fails to allocate route_table
> for a switch.
> 

kfree() accepts NULL pointers.  People have been removing these checks
all over the tree by the hundreds...  Sorry I should have mentioned 
that.

regards,
dan carpenter



  reply	other threads:[~2011-03-21 14:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-19  4:40 [patch] rapidio: potential null deref on failure path Dan Carpenter
2011-03-19  4:40 ` Dan Carpenter
2011-03-21 12:49 ` Bounine, Alexandre
2011-03-21 12:49   ` Bounine, Alexandre
2011-03-21 14:59   ` Dan Carpenter [this message]
2011-03-21 14:59     ` Dan Carpenter
2011-03-21 15:15     ` Bounine, Alexandre
2011-03-21 15:15       ` Bounine, Alexandre
2011-03-21 15:52       ` Dan Carpenter
2011-03-21 15:52         ` Dan Carpenter
2011-03-21 16:05         ` Bounine, Alexandre
2011-03-21 16:05           ` Bounine, Alexandre
2011-03-21 18:34 ` Bounine, Alexandre
2011-03-21 18:34   ` Bounine, Alexandre

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=20110321145948.GP2008@bicker \
    --to=error27@gmail.com \
    --cc=Alexandre.Bounine@idt.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mporter@kernel.crashing.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.