Re: [mmotm:master 251/287] lib/test-string_helpers.c:293:1: warning: the frame size of 1316 bytes is larger than 1024 bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 30 Aug 2014 07:28:12 +0800 kbuild test robot <fengguang.wu@xxxxxxxxx> wrote:

> tree:   git://git.cmpxchg.org/linux-mmotm.git master
> head:   8f1fc64dc9b39fedb7390e086001ce5ec327e80d
> commit: 626105764fd29c75bd8b01d36b54d0aaca61ac36 [251/287] lib / string_helpers: introduce string_escape_mem()
> config: make ARCH=i386 allyesconfig
> 
> All warnings:
> 
>    lib/test-string_helpers.c: In function 'test_string_escape':
> >> lib/test-string_helpers.c:293:1: warning: the frame size of 1316 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>     }

1k isn't excessive for an __init function but I guess we should fix it
to avoid drawing attention to ourselves.

Andy, please review, test, etc?


I figure the out-of-memory warning means we don't need a warning
printk.  It won't happen anyway.


--- a/lib/test-string_helpers.c~lib-string_helpers-introduce-string_escape_mem-fix
+++ a/lib/test-string_helpers.c
@@ -5,6 +5,7 @@
 
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/random.h>
 #include <linux/string.h>
@@ -62,10 +63,14 @@ static const struct test_string strings[
 static void __init test_string_unescape(const char *name, unsigned int flags,
 					bool inplace)
 {
-	char in[256];
-	char out_test[256];
-	char out_real[256];
-	int i, p = 0, q_test = 0, q_real = sizeof(out_real);
+	int q_real = 256;
+	char *in = kmalloc(q_real, GFP_KERNEL);
+	char *out_test = kmalloc(q_real, GFP_KERNEL);
+	char *out_real = kmalloc(q_real, GFP_KERNEL);
+	int i, p = 0, q_test = 0;
+
+	if (!in || !out_test || !out_real)
+		goto out;
 
 	for (i = 0; i < ARRAY_SIZE(strings); i++) {
 		const char *s = strings[i].in;
@@ -100,6 +105,10 @@ static void __init test_string_unescape(
 
 	test_string_check_buf(name, flags, in, p - 1, out_real, q_real,
 			      out_test, q_test);
+out:
+	kfree(out_real);
+	kfree(out_test);
+	kfree(in);
 }
 
 struct test_string_1 {
@@ -255,10 +264,15 @@ static __init void test_string_escape(co
 				      const struct test_string_2 *s2,
 				      unsigned int flags, const char *esc)
 {
-	char in[256];
-	char out_test[512];
-	char out_real[512], *buf = out_real;
-	int p = 0, q_test = 0, q_real = sizeof(out_real);
+	int q_real = 512;
+	char *out_test = kmalloc(q_real, GFP_KERNEL);
+	char *out_real = kmalloc(q_real, GFP_KERNEL);
+	char *in = kmalloc(256, GFP_KERNEL);
+	char *buf = out_real;
+	int p = 0, q_test = 0;
+
+	if (!out_test || !out_real || !in)
+		goto out;
 
 	for (; s2->in; s2++) {
 		const char *out;
@@ -289,7 +303,12 @@ static __init void test_string_escape(co
 
 	q_real = string_escape_mem(in, p, &buf, q_real, flags, esc);
 
-	test_string_check_buf(name, flags, in, p, out_real, q_real, out_test, q_test);
+	test_string_check_buf(name, flags, in, p, out_real, q_real, out_test,
+			      q_test);
+out:
+	kfree(in);
+	kfree(out_real);
+	kfree(out_test);
 }
 
 static __init void test_string_escape_nomem(void)
_

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]