提交 dbdb9045 编写于 作者: A Andrew Morton 提交者: Linus Torvalds

[PATCH] revert oversized kmalloc check

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: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 86513e72
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册