Re: Bug in kmem_cache_create with duplicate names

From: Steven Rostedt
Date: Tue Dec 07 2004 - 11:25:06 EST


On Tue, 2004-12-07 at 07:33 -0800, Randy.Dunlap wrote:

> Duplicate name can just return NULL. NOTE: Such a change most
> likely requires an audit of all callers of kmem_cache_create()
> to be sure that they check its return value. There's a gcc
> attribute that can be added to the function prototype to
> warn if the function is called without looking at its
> return value, although just doing
> x = kmem_cache_create(...);
> and ignoring x probably evades the warning.
>

I would hope that the kernel does check the return, since it still can
fail for other reasons an return a NULL, and it is more likely to fail
for other reasons, since this will already BUG on the duplicate case.
But your suggestion is probably a good one, and I'm sure there are
probably other calls that should have that same check.

-- Steve
-
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/