
From: Andrew Morton <akpm@osdl.org>

This doesn't work (on alpha, at least).

It's not inside __builtin_constant_p() so the compiler cannot be sure that all
the possible sizes have been checked for.

Cc: Christoph Lameter <clameter@engr.sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 mm/slab.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff -puN mm/slab.c~numa-aware-slab-allocator-v3-__bad_size-fix mm/slab.c
--- 25-alpha/mm/slab.c~numa-aware-slab-allocator-v3-__bad_size-fix	2005-06-06 23:46:25.000000000 -0700
+++ 25-alpha-akpm/mm/slab.c	2005-06-06 23:46:25.000000000 -0700
@@ -321,7 +321,8 @@ struct kmem_list3 __initdata initkmem_li
  */
 static inline int index_of(const size_t size)
 {
-	int i = 0;
+	if (__builtin_constant_p(size)) {
+		int i = 0;
 
 #define CACHE(x) \
 	if (size <=x) \
@@ -330,11 +331,12 @@ static inline int index_of(const size_t 
 		i++;
 #include "linux/kmalloc_sizes.h"
 #undef CACHE
-	{
-		extern void __bad_size(void);
-		__bad_size();
-		return 0;
+		{
+			extern void __bad_size(void);
+			__bad_size();
+		}
 	}
+	return 0;
 }
 
 #define INDEX_AC index_of(sizeof(struct arraycache_init))
_
