summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2023-05-14 00:21:44 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2023-05-14 02:42:52 +0200
commit0b89bb297516791243b93e8d71a83339ea961b11 (patch)
tree95da7b269a69ed135ed57570bb0c26d70c22be2b
parent95d5a99537a587103976120de0b0ba4d27e07d62 (diff)
downloadopenwrt-0b89bb297516791243b93e8d71a83339ea961b11.tar.gz
kernel: ltq-vectoring: add patch fixing compilation warning
Add patch fixing compilation warning related to stack limit. Fix compilation warning: /builder/shared-workdir/build/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ltq-vectoring-2019-05-20-4fa7ac30/src/vectoring/ifxmips_vectoring.c: In function 'proc_write_dbg': /builder/shared-workdir/build/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ltq-vectoring-2019-05-20-4fa7ac30/src/vectoring/ifxmips_vectoring.c:369:1: error: the frame size of 2088 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] 369 | } | ^ cc1: all warnings being treated as errors Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r--package/kernel/lantiq/ltq-vectoring/patches/300-fix-compilation-warning-stack-limit.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/package/kernel/lantiq/ltq-vectoring/patches/300-fix-compilation-warning-stack-limit.patch b/package/kernel/lantiq/ltq-vectoring/patches/300-fix-compilation-warning-stack-limit.patch
new file mode 100644
index 0000000000..4d18f8e3b7
--- /dev/null
+++ b/package/kernel/lantiq/ltq-vectoring/patches/300-fix-compilation-warning-stack-limit.patch
@@ -0,0 +1,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;
+ }
+