300-fix-compilation-warning-stack-limit.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. --- a/src/vectoring/ifxmips_vectoring.c
  2. +++ b/src/vectoring/ifxmips_vectoring.c
  3. @@ -300,7 +300,7 @@ static int proc_write_dbg(struct file *f
  4. DBG_ENABLE_MASK_ALL
  5. };
  6. - char str[2048];
  7. + char *str;
  8. char *p;
  9. int len, rlen;
  10. @@ -308,6 +308,10 @@ static int proc_write_dbg(struct file *f
  11. int f_enable = 0;
  12. int i;
  13. + str = kcalloc(2048, sizeof(*str), GFP_KERNEL);
  14. + if (!str)
  15. + return -ENOMEM;
  16. +
  17. len = count < sizeof(str) ? count : sizeof(str) - 1;
  18. rlen = len - copy_from_user(str, buf, len);
  19. while ( rlen && str[rlen - 1] <= ' ' )
  20. @@ -367,6 +371,8 @@ static int proc_write_dbg(struct file *f
  21. }
  22. }
  23. + kfree(str);
  24. +
  25. return count;
  26. }
  27. --- a/src/vectoring/ifxmips_vectoring_test.c
  28. +++ b/src/vectoring/ifxmips_vectoring_test.c
  29. @@ -3,6 +3,7 @@
  30. #include <linux/module.h>
  31. #include <linux/proc_fs.h>
  32. #include <linux/seq_file.h>
  33. +#include <linux/slab.h>
  34. #include "ifxmips_vectoring_stub.h"
  35. @@ -46,13 +47,17 @@ static int proc_write_vectoring(struct f
  36. {
  37. char *p;
  38. int len;
  39. - char local_buf[1024];
  40. + char *local_buf;
  41. unsigned long pkt_len;
  42. int ret;
  43. unsigned long sys_flag;
  44. unsigned long start, end;
  45. + local_buf = kcalloc(1024, sizeof(*local_buf), GFP_KERNEL);
  46. + if (!local_buf)
  47. + return -ENOMEM;
  48. +
  49. len = sizeof(local_buf) < count ? sizeof(local_buf) - 1 : count;
  50. len = len - copy_from_user(local_buf, buf, len);
  51. local_buf[len] = 0;
  52. @@ -81,6 +86,8 @@ static int proc_write_vectoring(struct f
  53. else
  54. printk("echo send <size> > /proc/driver/vectoring_test\n");
  55. + kfree(local_buf);
  56. +
  57. return count;
  58. }