Commit a4dbf0ec authored by Yuanhan Liu's avatar Yuanhan Liu Committed by 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: default avatarYuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e130aa70
...@@ -138,9 +138,9 @@ static int stat_open(struct inode *inode, struct file *file) ...@@ -138,9 +138,9 @@ static int stat_open(struct inode *inode, struct file *file)
struct seq_file *m; struct seq_file *m;
int res; int res;
/* don't ask for more than the kmalloc() max size, currently 128 KB */ /* don't ask for more than the kmalloc() max size */
if (size > 128 * 1024) if (size > KMALLOC_MAX_SIZE)
size = 128 * 1024; size = KMALLOC_MAX_SIZE;
buf = kmalloc(size, GFP_KERNEL); buf = kmalloc(size, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment