[lkml]   [2007]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
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

It's much safer to deal with this at slab level so why leave it out?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-03-19 18:33    [W:0.083 / U:1.592 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site