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

From: JÃrn Engel
Date: Wed Mar 21 2007 - 14:00:31 EST


On Wed, 21 March 2007 08:30:27 -0800, Andrew Morton wrote:
> On Wed, 21 Mar 2007 16:41:19 +0200 "Pekka Enberg" <penberg@xxxxxxxxxxxxxx> wrote:
>
> > Yeah, I'll try to sneak a patch past Andrew.
>
> That would be sneaky.
>
> Thing is, such a patch would amount to adding a test-for-NULL to codepaths
> which we *know* do not need it. There is no point in doing that.

How about two patches, one renaming kmem_cache_free to
kmem_cache_free_fast or __kmem_cache_free or whatever pleases you most,
the second adding kmem_cache_free with a NULL check.

The point is that the easiest way to use kmem_cache_free should be the
safest, but not necessarily the fastest. Existing well-tuned and
NULL-aware code paths can remain fast, random new code will be safe.

JÃrn

--
Joern's library part 14:
http://www.sandpile.org/
-
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/