From: Stephen Hemminger Date: Sun, 29 Nov 2020 17:40:49 +0000 (-0800) Subject: tc: fix compiler warnings in ip6 pedit X-Git-Tag: v5.10.0~6^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2319db905295fa47c651b52ae09a8d7bf305c6f7;p=thirdparty%2Fiproute2.git tc: fix compiler warnings in ip6 pedit Gcc-10 complains about referencing a zero size array. This occurs because the array of keys is actually in the following structure which is part of the overall selector. The original code was safe, but better to just use the key array directly. Fixes: 2d9a8dc439ee ("tc: p_ip6: Support pedit of IPv6 dsfield") Cc: petrm@mellanox.com Signed-off-by: Stephen Hemminger --- diff --git a/tc/p_ip6.c b/tc/p_ip6.c index 71660c610..83a6ae818 100644 --- a/tc/p_ip6.c +++ b/tc/p_ip6.c @@ -82,7 +82,7 @@ parse_ip6(int *argc_p, char ***argv_p, /* Shift the field by 4 bits on success. */ if (!res) { int nkeys = sel->sel.nkeys; - struct tc_pedit_key *key = &sel->sel.keys[nkeys - 1]; + struct tc_pedit_key *key = &sel->keys[nkeys - 1]; key->mask = htonl(ntohl(key->mask) << 4 | 0xf); key->val = htonl(ntohl(key->val) << 4);