Skip to contentSkip to conversation

proc/stat: use defined macro KMALLOC_MAX_SIZE

PATCH New Yuanhan Liu 1 participant 1 message Mar 22, 2011 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 fs/proc/stat.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fs/proc/stat.c +3 -3
index 1cffa2b..9758b65 100644
@@ -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;
Signature · 1 line
1.7.4