lkml.org 
[lkml]   [2007]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] slab: deal with NULL pointers passed to kmem_cache_free
On Mon, 19 Mar 2007, Christoph Lameter wrote:
> Hmmm.. kmem_cache_free is significantly different. One also needs to
> specify the slab cache.

No, it really isn't. Why would we want kfree() to be special? It's only
going to confuse people which results in bugs.

On Mon, 19 Mar 2007, Christoph Lameter wrote:
> Could we fix the BUG instead?

Yes, it should be fixed. But we still have a problem with block layer
(and probably others) passing NULL to mempool_free. But where should we
fix it if not slab? Is the problem ih bio_alloc_bioset() in fs/bio.c as
it's leaving a ->bi_io_vec NULL? Or is it in bio_free() forgetting to
check for NULL? Or maybe in mempool_free() in mm/mempool.c? It gets messy
real quick because you do need to be able to say "this data is optional."
Furthemore, the NULL sematics of kfree() are also useful for error
handling.
It's much safer to deal with this at slab level so why leave it out?

Pekka
-
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: 2007-03-19 18:33    [W:0.286 / U:0.004 seconds]
©2003-2011 Jasper Spaans. Advertise on this site