Skip to content

Commit a4dbf0e

Browse files
Yuanhan Liutorvalds
authored andcommitted
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 <yuanhan.liu@linux.intel.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e130aa7 commit a4dbf0e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎fs/proc/stat.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ static int stat_open(struct inode *inode, struct file *file)
138138
struct seq_file *m;
139139
int res;
140140

141-
/* don't ask for more than the kmalloc() max size, currently 128 KB */
142-
if (size > 128 * 1024)
143-
size = 128 * 1024;
141+
/* don't ask for more than the kmalloc() max size */
142+
if (size > KMALLOC_MAX_SIZE)
143+
size = KMALLOC_MAX_SIZE;
144144
buf = kmalloc(size, GFP_KERNEL);
145145
if (!buf)
146146
return -ENOMEM;

0 commit comments

Comments
 (0)