lkml.org 
[lkml]   [2006]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 9pfs double kfree
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 <davej@redhat.com> 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 <jesper.juhl@gmail.com>
Mon, 7 Nov 2005 09:01:26 +0000 (01:01 -0800)
committer Linus Torvalds <torvalds@g5.osdl.org>
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 <jesper.juhl@gmail.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-03-06 13:12    [W:0.097 / U:0.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site