mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
93 lines
3.5 KiB
Diff
Executable file
93 lines
3.5 KiB
Diff
Executable file
commit 341132ae81d3531bba093c45f9efc38ab2b19a8c
|
|
Author: Ken Zhu <guigenz@codeaurora.org>
|
|
Date: Sun Sep 20 17:28:15 2020 -0700
|
|
|
|
xtables-addons: fix strict check waring
|
|
|
|
stricter check break compiling, fix these issues.
|
|
|
|
Change-Id: Ie8feecf713e5eda879cf19faed57fa4724d46023
|
|
Signed-off-by: Ken Zhu <guigenz@codeaurora.org>
|
|
|
|
diff -Nur a/extensions/LUA/byte_array.c xtables-addons-2.14/extensions/LUA/byte_array.c
|
|
--- a/extensions/LUA/byte_array.c 2020-09-25 13:59:21.118624846 -0700
|
|
+++ xtables-addons-2.14/extensions/LUA/byte_array.c 2020-09-25 14:21:16.187637179 -0700
|
|
@@ -107,12 +107,15 @@
|
|
static int32_t byte_array_to_string(lua_State *L)
|
|
{
|
|
lua_packet_segment * array = checkbytearray(L, 1);
|
|
- uint8_t buf[(array->length * 3) + 255];
|
|
+ uint8_t *buf = kmalloc((array->length * 3) + 255, GFP_KERNEL);
|
|
uint8_t hexval[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
|
- char res[255 + (array->length * 3)]; /* make sure the buffer is big enough*/
|
|
+ char *res= kmalloc(255 + (array->length * 3), GFP_KERNEL); /* make sure the buffer is big enough*/
|
|
int32_t i, n;
|
|
uint8_t *ptr = array->start + array->offset;
|
|
|
|
+ if (!buf || !res)
|
|
+ goto kmalloc_out;
|
|
+
|
|
for (i = 0; i < array->length; i++) {
|
|
buf[i * 3] = hexval[(ptr[i] >> 4) & 0xF];
|
|
buf[(i * 3) + 1] = hexval[ptr[i] & 0x0F];
|
|
@@ -124,6 +127,9 @@
|
|
|
|
lua_pushlstring(L, res, n);
|
|
|
|
+kmalloc_out:
|
|
+ if (buf) kfree(buf);
|
|
+ if (res) kfree(res);
|
|
return 1;
|
|
}
|
|
|
|
diff -Nur a/extensions/LUA/lua/ldebug.c xtables-addons-2.14/extensions/LUA/lua/ldebug.c
|
|
--- a/extensions/LUA/lua/ldebug.c 2020-09-25 13:59:21.118624846 -0700
|
|
+++ xtables-addons-2.14/extensions/LUA/lua/ldebug.c 2020-09-25 13:59:48.066359910 -0700
|
|
@@ -412,6 +412,9 @@
|
|
case OP_FORPREP:
|
|
checkreg(pt, a+3);
|
|
/* go through */
|
|
+#if __has_attribute(__fallthrough__)
|
|
+ __attribute__((__fallthrough__));
|
|
+#endif
|
|
case OP_JMP: {
|
|
int dest = pc+1+b;
|
|
/* not full check and jump is forward and do not skip `lastpc'? */
|
|
diff -Nur a/extensions/LUA/lua/llex.c xtables-addons-2.14/extensions/LUA/lua/llex.c
|
|
--- a/extensions/LUA/lua/llex.c 2020-09-25 13:59:21.122624806 -0700
|
|
+++ xtables-addons-2.14/extensions/LUA/lua/llex.c 2020-09-25 13:59:48.066359910 -0700
|
|
@@ -365,6 +365,9 @@
|
|
else if (sep == -1) return '[';
|
|
else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
|
|
}
|
|
+#if __has_attribute(__fallthrough__)
|
|
+ __attribute__((__fallthrough__));
|
|
+#endif
|
|
case '=': {
|
|
next(ls);
|
|
if (ls->current != '=') return '=';
|
|
diff -Nur a/extensions/LUA/lua/ltable.c xtables-addons-2.14/extensions/LUA/lua/ltable.c
|
|
--- a/extensions/LUA/lua/ltable.c 2020-09-25 13:59:21.118624846 -0700
|
|
+++ xtables-addons-2.14/extensions/LUA/lua/ltable.c 2020-09-25 13:59:48.066359910 -0700
|
|
@@ -477,6 +477,9 @@
|
|
return luaH_getnum(t, k); /* use specialized version */
|
|
/* else go through */
|
|
}
|
|
+#if __has_attribute(__fallthrough__)
|
|
+ __attribute__((__fallthrough__));
|
|
+#endif
|
|
default: {
|
|
Node *n = mainposition(t, key);
|
|
do { /* check whether `key' is somewhere in the chain */
|
|
diff -Nur a/extensions/LUA/lua/ltablib.c xtables-addons-2.14/extensions/LUA/lua/ltablib.c
|
|
--- a/extensions/LUA/lua/ltablib.c 2020-09-25 13:59:21.122624806 -0700
|
|
+++ xtables-addons-2.14/extensions/LUA/lua/ltablib.c 2020-09-25 13:59:48.066359910 -0700
|
|
@@ -137,7 +137,7 @@
|
|
if (!lua_isstring(L, -1))
|
|
luaL_error(L, "invalid value (%s) at index %d in table for "
|
|
LUA_QL("concat"), luaL_typename(L, -1), i);
|
|
- luaL_addvalue(b);
|
|
+ luaL_addvalue(b);
|
|
}
|
|
|
|
|