aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/lantiq/ltq-vectoring/patches/300-fix-compilation-warning-stack-limit.patch
blob: 4d18f8e3b7a44142c0ab3bd2d1b7af428f941f7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
--- a/src/vectoring/ifxmips_vectoring.c
+++ b/src/vectoring/ifxmips_vectoring.c
@@ -298,7 +298,7 @@ static int proc_write_dbg(struct file *file, const char __user *buf, size_t coun
         DBG_ENABLE_MASK_ALL
     };
 
-    char str[2048];
+    char *str;
     char *p;
 
     int len, rlen;
@@ -306,6 +306,10 @@ static int proc_write_dbg(struct file *file, const char __user *buf, size_t coun
     int f_enable = 0;
     int i;
 
+    str = kcalloc(2048, sizeof(*str), GFP_KERNEL);
+    if (!str)
+        return -ENOMEM;
+
     len = count < sizeof(str) ? count : sizeof(str) - 1;
     rlen = len - copy_from_user(str, buf, len);
     while ( rlen && str[rlen - 1] <= ' ' )
@@ -365,6 +369,8 @@ static int proc_write_dbg(struct file *file, const char __user *buf, size_t coun
         }
     }
 
+    kfree(str);
+
     return count;
 }
 
--- a/src/vectoring/ifxmips_vectoring_test.c
+++ b/src/vectoring/ifxmips_vectoring_test.c
@@ -3,6 +3,7 @@
 #include <linux/module.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/slab.h>
 
 #include "ifxmips_vectoring_stub.h"
 
@@ -46,13 +47,17 @@ static int proc_write_vectoring(struct file *file, const char __user *buf, size_
 {
     char *p;
     int len;
-    char local_buf[1024];
+    char *local_buf;
 
     unsigned long pkt_len;
     int ret;
     unsigned long sys_flag;
     unsigned long start, end;
 
+    local_buf = kcalloc(1024, sizeof(*local_buf), GFP_KERNEL);
+    if (!local_buf)
+        return -ENOMEM;
+
     len = sizeof(local_buf) < count ? sizeof(local_buf) - 1 : count;
     len = len - copy_from_user(local_buf, buf, len);
     local_buf[len] = 0;
@@ -81,6 +86,8 @@ static int proc_write_vectoring(struct file *file, const char __user *buf, size_
     else
         printk("echo send <size> > /proc/driver/vectoring_test\n");
 
+    kfree(local_buf);
+
     return count;
 }