提交 a4dbf0ec 编写于 作者: Y Yuanhan Liu 提交者: Linus Torvalds

proc/stat: use defined macro KMALLOC_MAX_SIZE

There is a macro for the max size kmalloc can allocate, so use it instead
of a hardcoded number.
Signed-off-by: NYuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e130aa70
......@@ -138,9 +138,9 @@ static int stat_open(struct inode *inode, struct file *file)
struct seq_file *m;
int res;
/* don't ask for more than the kmalloc() max size, currently 128 KB */
if (size > 128 * 1024)
size = 128 * 1024;
/* don't ask for more than the kmalloc() max size */
if (size > KMALLOC_MAX_SIZE)
size = KMALLOC_MAX_SIZE;
buf = kmalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册