]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] revert oversized kmalloc check
authorAndrew Morton <akpm@osdl.org>
Fri, 23 Sep 2005 20:24:10 +0000 (13:24 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 23 Sep 2005 20:35:37 +0000 (13:35 -0700)
As davem points out, this wasn't such a great idea.  There may be some code
which does:

size = 1024*1024;
while (kmalloc(size, ...) == 0)
size /= 2;

which will now explode.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Christoph Lameter <christoph@lameter.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/slab.c

index ad113c431e39053a7ac605f8fc3e20aa927eaf96..c9adfce004056d2539ffa04a9ab09c1a2773d89d 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2907,7 +2907,8 @@ void *__kmalloc(size_t size, unsigned int __nocast flags)
         * functions.
         */
        cachep = __find_general_cachep(size, flags);
-       BUG_ON(!cachep);                /* Allocation size too large for kmalloc */
+       if (unlikely(cachep == NULL))
+               return NULL;
        return __cache_alloc(cachep, flags);
 }
 EXPORT_SYMBOL(__kmalloc);