[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-netdev
Subject:    Re: [PATCH] Allow kfree_skb to be called with a NULL argument
From:       Michael Buesch <mbuesch () freenet ! de>
Date:       2006-02-22 17:58:59
Message-ID: 200602221858.59918.mbuesch () freenet ! de
[Download RAW message or body]

On Wednesday 22 February 2006 18:52, you wrote:
> On Wed, 22 February 2006 18:44:33 +0100, Michael Buesch wrote:
> > On Wednesday 22 February 2006 09:26, you wrote:
> > > Fairly trivial.  The extra conditional should get optimized away with
> > > current code.  But it also allows to walk through network drivers and
> > > get rid of the permanent
> > > 	if (skb)
> > > 		kfree(skb);
> > > conditionals.
> > 
> > I am all for this change, but I am wondering how this is
> > possible to get optimized away... The compiler can't know
> > if a skb variable is NULL or not, at runtime.
> 
> if (skb) {
> 	/* the compiler can know that skb is non-NULL now */
> 	kfree_skb(skb);
> }
> 
> I must admit that I haven't tested whether gcc will optimize it away,
> though.

Ah, well. I was talking about the
//foo
kfree_skb(skb);
//bar
case, which has an additional if added, now. But that is OK. I like it.
I recently had a bug in bcm43xx, because I assumed kfree_skb can take
a NULL pointer, as any free function can.

-- 
Greetings Michael.

[Attachment #3 (application/pgp-signature)]
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic