From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 72AA3A0A0E; Tue, 11 May 2021 15:15:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0B72A41114; Tue, 11 May 2021 15:14:53 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 9C9FF40697; Tue, 11 May 2021 15:14:49 +0200 (CEST) IronPort-SDR: rR2vKyWLuj2r1JlZTbBwIEpDSeaGnRUnZofEDvsDYFs+vsrodcERbGdLy7i/G1Zcf/U9rgfabu moJr77/HNeZw== X-IronPort-AV: E=McAfee;i="6200,9189,9980"; a="284928134" X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="284928134" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 06:14:48 -0700 IronPort-SDR: 33jfczyYCE7cljg5NynHwxyXFoz3NlXXo5JGdliG8DVlkqrh+oBpLXx2fwxJVzNT+kMmKeujc2 GQ6Q2J+C86Ag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="537021140" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by fmsmga001.fm.intel.com with ESMTP; 11 May 2021 06:14:46 -0700 From: Ferruh Yigit To: Keith Wiles , Pascal Mazon , Olga Shern Cc: Ferruh Yigit , dev@dpdk.org, stable@dpdk.org, Kevin Traynor Date: Tue, 11 May 2021 14:14:35 +0100 Message-Id: <20210511131435.1226820-4-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511131435.1226820-1-ferruh.yigit@intel.com> References: <20210510150319.1496105-1-ferruh.yigit@intel.com> <20210511131435.1226820-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 4/4] net/tap: fix build with gcc11 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Reproduced with '--buildtype=debugoptimized' config, compiler version: gcc (GCC) 12.0.0 20210509 (experimental) There are multiple build errors, like: In file included from ../drivers/net/tap/tap_flow.c:13: In function ‘rte_jhash_2hashes’, inlined from ‘rte_jhash’ at ../lib/hash/rte_jhash.h:284:2, inlined from ‘tap_flow_set_handle’ at ../drivers/net/tap/tap_flow.c:1306:12, inlined from ‘rss_enable’ at ../drivers/net/tap/tap_flow.c:1909:3, inlined from ‘priv_flow_process’ at ../drivers/net/tap/tap_flow.c:1228:11: ../lib/hash/rte_jhash.h:238:9: warning: ‘flow’ may be used uninitialized [-Wmaybe-uninitialized] 238 | __rte_jhash_2hashes(key, length, pc, pb, 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../drivers/net/tap/tap_flow.c: In function ‘priv_flow_process’: ../lib/hash/rte_jhash.h:81:1: note: by argument 1 of type ‘const void *’ to ‘__rte_jhash_2hashes.constprop’ declared here 81 | __rte_jhash_2hashes(const void *key, uint32_t length, uint32_t *pc, | ^~~~~~~~~~~~~~~~~~~ ../drivers/net/tap/tap_flow.c:1028:1: note: ‘flow’ declared here 1028 | priv_flow_process(struct pmd_internals *pmd, | ^~~~~~~~~~~~~~~~~ Fix strict aliasing rule by using union. Bugzilla ID: 690 Fixes: de96fe68ae95 ("net/tap: add basic flow API patterns and actions") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit Acked-by: Kevin Traynor --- Cc: pascal.mazon@6wind.com v3: * Add missing Bugzilla tag --- drivers/net/tap/tap_flow.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index 1ee6fb30ab2d..c4f60ce98e5e 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -1300,10 +1300,16 @@ tap_flow_validate(struct rte_eth_dev *dev, static void tap_flow_set_handle(struct rte_flow *flow) { + union { + struct rte_flow *flow; + const void *key; + } tmp; uint32_t handle = 0; + tmp.flow = flow; + if (sizeof(flow) > 4) - handle = rte_jhash(&flow, sizeof(flow), 1); + handle = rte_jhash(tmp.key, sizeof(flow), 1); else handle = (uintptr_t)flow; /* must be at least 1 to avoid letting the kernel choose one for us */ -- 2.31.1