From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 34412A04E7;
	Sun, 29 Nov 2020 18:56:36 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 863B9C9D2;
	Sun, 29 Nov 2020 18:55:07 +0100 (CET)
Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com
 [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 4DB8EC9A4
 for <dev@dpdk.org>; Sun, 29 Nov 2020 18:54:59 +0100 (CET)
Received: by mail-pl1-f194.google.com with SMTP id v21so5154281plo.12
 for <dev@dpdk.org>; Sun, 29 Nov 2020 09:54:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=i/b3F1OiqGDBMwbHm3iD7dfFR9hiS2R0OKWSeitmuMk=;
 b=qQkcws/55pL5gVd0rXkjI+E1ay0gcP4U/8FHVGM19iHS8T0G6A3yV440BgxphkCzZl
 gkFFrzd6F6Hsx0uCl/J4n/7Xb+S1u5vpgZkC/Ty4foIgrtxFyevAxICvzdwcc1JhBYMf
 5uF2wHaoU0L2VOMJKg7zolGTFcfUPYCtS5X38FUadJQj/u3RH8m2MBIvU8R9St4VYwbB
 gHXyOTYkkwsqQ4EIiq32b54UPPgelnjBMqI42jSTzK3QOMI7VXHpPEv+KY2No2P2724w
 Llz5DDsGweERqsxJOvZQvHcmXdtzxW1G1OD7n7+1sKxT9NiW2xihmkd9X+kLf0MLdTod
 GPkw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=i/b3F1OiqGDBMwbHm3iD7dfFR9hiS2R0OKWSeitmuMk=;
 b=OseGACP9LHDWEvhy4/M+XsJOP8/BIrLcp9NW5NL9oorsypbLTioCF2yONBA7Glu+PK
 KQOrvA8HiCjp8fIVLdNT8fTzHuybshHN109JB69hbTJvtRIbM6qmqdeLOHf1G2N8XCgN
 3p04dwJpjsfST55w/TmNEFBIMmEZpY5eNmroRny/8rhjQHnJuH0Ib++lldQBEl41YJ21
 +JinA+8TsdSPdFIwWENbqUB6Swq0nvmqjQzHkvi3tvKMPUDPiqTAPLByQXqp/hXjCFRc
 SGxm74skxMDsx+Om7ITUBfCPPbGpDEGKoY1t2Fwiif5fVi5msVUu1RbgwP/Ce/U5AzAk
 1ZcQ==
X-Gm-Message-State: AOAM532RbWbvoExvdFgomD5Vq9+mD5JuKBHYXg2gYcZDIm9FtHbpuwkL
 o2YFiUhLpMO+P/8TRMD1nZM/iwiYtWF3JEhf
X-Google-Smtp-Source: ABdhPJyHVUcWM4biERj2456LSzNw1akPd8oozo/Gf1RmdeGL5RG7OzmQ7BFD+hkvMLPtuLd+w4BgFA==
X-Received: by 2002:a17:902:7e85:b029:da:726a:3a4f with SMTP id
 z5-20020a1709027e85b02900da726a3a4fmr3160078pla.65.1606672497156; 
 Sun, 29 Nov 2020 09:54:57 -0800 (PST)
Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id l23sm13114850pgn.40.2020.11.29.09.54.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 29 Nov 2020 09:54:56 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Date: Sun, 29 Nov 2020 09:54:37 -0800
Message-Id: <20201129175437.15346-6-stephen@networkplumber.org>
X-Mailer: git-send-email 2.29.2
In-Reply-To: <20201129175437.15346-1-stephen@networkplumber.org>
References: <20201129175437.15346-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH 5/5] f_u32: fix compiler gcc-10 compiler warning
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tc/f_u32.c b/tc/f_u32.c
index e0a322d5a11c..2ed5254a40d5 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -1110,7 +1110,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
 				}
 				NEXT_ARG();
 			}
-			hash = sel2.sel.keys[0].val & sel2.sel.keys[0].mask;
+			hash = sel2.keys[0].val & sel2.keys[0].mask;
 			hash ^= hash >> 16;
 			hash ^= hash >> 8;
 			htid = ((hash % divisor) << 12) | (htid & 0xFFF00000);
-- 
2.29.2