From: Yuanhan Liu Date: Thu, 26 May 2011 23:25:51 +0000 (-0700) Subject: proc/stat: use defined macro KMALLOC_MAX_SIZE X-Git-Tag: firefly_0821_release~7613^2~1067 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a4dbf0ec2aa3e8aca6e63f598095750c232d50f1;p=firefly-linux-kernel-4.4.55.git 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: Yuanhan Liu Cc: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 1cffa2b8a2fc..9758b654a1bc 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c @@ -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;