Re: 9pfs double kfree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 6 Mar 2006, Al Viro wrote:

> On Mon, Mar 06, 2006 at 09:56:22AM +0200, Pekka Enberg wrote:
> > On 3/6/06, Dave Jones <[email protected]> wrote:
> > > I wonder if we could get away with something as simple as..
> > >
> > > #define kfree(foo) \
> > >         __kfree(foo); \
> > >         foo = KFREE_POISON;
> > >
> > > ?
> > 
> > It's legal to call kfree() twice for NULL pointer. The above poisons
> > foo unconditionally which makes that case break I think.
> 
> Legal, but rather bad taste.  Init to NULL, possibly assign the value
> if kmalloc(), then kfree() unconditionally - sure, but that... almost
> certainly one hell of a lousy cleanup logics somewhere.
> 
I agree with you.

However, a few months ago it was advocated to let kfree take care of 
testing the pointer against NULL and a load of patches like this:

[PATCH] kfree cleanup: drivers/scsi
author	Jesper Juhl <[email protected]>
	Mon, 7 Nov 2005 09:01:26 +0000 (01:01 -0800)
committer	Linus Torvalds <[email protected]>
	Mon, 7 Nov 2005 15:54:01 +0000 (07:54 -0800)
commit	c9475cb0c358ff0dd473544280d92482df491913
tree	091617d0bdab9273d44139c86af21b7540e6d9b1	tree
parent	089b1dbbde28f0f641c20beabba28fa89ab4fab9	commit | 
commitdiff
[PATCH] kfree cleanup: drivers/scsi

This is the drivers/scsi/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in 
drivers/scsi/.

Signed-off-by: Jesper Juhl <[email protected]>
Cc: James Bottomley <[email protected]>
Acked-by: Kai Makisara <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>


went in. I wonder what will come next when wind changes.

-- 
Kai
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux