]> git.proxmox.com Git - mirror_iproute2.git/commit
f_u32: fix compiler gcc-10 compiler warning
authorStephen Hemminger <stephen@networkplumber.org>
Sun, 29 Nov 2020 17:47:44 +0000 (09:47 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 30 Nov 2020 00:20:33 +0000 (16:20 -0800)
commitcae2e9291adf298041418bf9fe5f149c612db105
tree55dbcad9c8daf8bc3f1413baacafd36ae7d763f1
parentc014983921389dc7880dfe368eb43cb2570f6a4b
f_u32: fix compiler gcc-10 compiler warning

With gcc-10 it complains about array subscript error.

f_u32.c: In function ‘u32_parse_opt’:
f_u32.c:1113:24: warning: array subscript 0 is outside the bounds of an interior zero-length array ‘struct tc_u32_key[0]’ [-Wzero-length-bounds]
 1113 |    hash = sel2.sel.keys[0].val & sel2.sel.keys[0].mask;
      |           ~~~~~~~~~~~~~^~~
In file included from tc_util.h:11,
                 from f_u32.c:26:
../include/uapi/linux/pkt_cls.h:253:20: note: while referencing ‘keys’
  253 |  struct tc_u32_key keys[0];
      |

This is because the keys are actually allocated in the second element
of the parent structure.

Simplest way to address the warning is to assign directly to the keys
in the containing structure.

This has always been in iproute2 (pre-git) so no Fixes.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/f_u32.c