Re: [PATCH] mm: Make it easier to catch NULL cache names

From: Linus Torvalds
Date: Mon Jul 27 2009 - 22:52:51 EST




On Tue, 28 Jul 2009, Benjamin Herrenschmidt wrote:
>
> Right now, if you inadvertently pass NULL to kmem_cache_create() at boot
> time, it crashes much later after boot somewhere deep inside sysfs which
> makes it very non obvious to figure out what's going on.

Please don't do BUG_ON() when there are alternatives.

In this case, something like

if (WARN_ON(!name))
return NULL;

would probably have worked too.

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