Re: [PATCH] slab: deal with NULL pointers passed to kmem_cache_free

From: Pekka J Enberg
Date: Mon Mar 19 2007 - 07:40:56 EST


Hi,

On Mon, 19 Mar 2007, Andrew Morton wrote:
> err, we don't want to do this, do we? It adds overhead for something which
> we've carefully taught all our programmers to not do. The only known code
> which will benefit from this is buggy.

Well, I actually disagree with that. It makes little sense for
kmem_cache_free() to behave differently from kfree() especially since the
overhead is minimal. But anyway, if you're unhappy with the patch, then we
should make it explicit that you're not allowed to pass NULL to
kmem_cache_free(), mempool_free() and perhaps others as well in which case
kfree() comes even more special...

I know this has been discussed in the past but I think you should be able
to blindly pass whetever pointer the allocator fuction gives you to the
corresponding release function which is why I wanted to fix
kmem_cache_free() in the first place.

On Mon, 19 Mar 2007, Andrew Morton wrote:
> s/fix/hide/

No, even though there is clearly some problem with either the scsi or
block layer not allocating any pages for the iovec, I do think slab should
deal with NULL pointers properly.

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