diff --git a/mm/slab.c b/mm/slab.c index ad113c431e39053a7ac605f8fc3e20aa927eaf96..c9adfce004056d2539ffa04a9ab09c1a2773d89d 100644 --- 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);