SLUB: Use BUILD_BUG_ON to flag too big slab caches Do not generate a link failure instead abort compilation using BUILD_BUG_ON Signed-off-by: Christoph Lameter Index: linux-2.6.21-rc7-mm1/include/linux/slub_def.h =================================================================== --- linux-2.6.21-rc7-mm1.orig/include/linux/slub_def.h 2007-04-25 11:38:00.000000000 -0700 +++ linux-2.6.21-rc7-mm1/include/linux/slub_def.h 2007-04-25 11:38:14.000000000 -0700 @@ -140,17 +140,11 @@ static inline struct kmem_cache *kmalloc { int index = kmalloc_index(size); + BUILD_BUG_ON(index < 0); + if (index == 0) return NULL; - if (index < 0) { - /* - * Generate a link failure. Would be great if we could - * do something to stop the compile here. - */ - extern void __kmalloc_size_too_large(void); - __kmalloc_size_too_large(); - } return &kmalloc_caches[index]; }