Skip to content

Commit

Permalink
[PATCH] revert oversized kmalloc check
Browse files Browse the repository at this point in the history
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" <[email protected]>
Cc: Christoph Lameter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Sep 23, 2005
1 parent 86513e7 commit dbdb904
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dbdb904

Please sign in to comment.