All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Prakash Shukla <amitprakashs@marvell.com>
To: Yuying Zhang <Yuying.Zhang@intel.com>,
	Beilei Xing <beilei.xing@intel.com>
Cc: <dev@dpdk.org>, <jerinj@marvell.com>,
	Amit Prakash Shukla <amitprakashs@marvell.com>, <stable@dpdk.org>
Subject: [PATCH 1/3] net/i40e: compilation fix for GCC-12
Date: Tue, 23 Aug 2022 16:27:40 +0530	[thread overview]
Message-ID: <20220823105742.2276506-1-amitprakashs@marvell.com> (raw)

GCC 12 raises the following warning:

meson --werror --buildtype=debugoptimized
	--cross-file config/x86/cross-mingw -Dexamples=helloworld build
ninja -C build

In function 'i40e_hash_get_pattern_type',
    inlined from 'i40e_hash_get_pattern_pctypes' at
../drivers/net/i40e/i40e_hash.c:520:8,
    inlined from 'i40e_hash_parse_pattern_act' at
../drivers/net/i40e/i40e_hash.c:1147:9,
    inlined from 'i40e_hash_parse' at
../drivers/net/i40e/i40e_hash.c:1181:9:
../drivers/net/i40e/i40e_hash.c:389:47:
	error: array subscript 53 is above array
	bounds of 'const uint64_t[53]'
	{aka 'const long long unsigned int[53]'} [-Werror=array-bounds]
  389 |                 item_hdr = pattern_item_header[last_item_type];
      |                            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
../drivers/net/i40e/i40e_hash.c: In function 'i40e_hash_parse':
../drivers/net/i40e/i40e_hash.c:182:23: note: while referencing
'pattern_item_header'
  182 | static const uint64_t pattern_item_header[] = {
      |                       ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Fixes: ef4c16fd9148 (net/i40e: refactor RSS flow)
Cc: stable@dpdk.org

Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
---
 drivers/net/i40e/i40e_hash.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_hash.c b/drivers/net/i40e/i40e_hash.c
index 8962e9d97a..a1ff85fceb 100644
--- a/drivers/net/i40e/i40e_hash.c
+++ b/drivers/net/i40e/i40e_hash.c
@@ -384,8 +384,10 @@ i40e_hash_get_pattern_type(const struct rte_flow_item pattern[],
 		}
 
 		prev_item_type = last_item_type;
-		assert(last_item_type < (enum rte_flow_item_type)
-				RTE_DIM(pattern_item_header));
+		if (last_item_type >= (enum rte_flow_item_type)
+				RTE_DIM(pattern_item_header))
+			goto not_sup;
+
 		item_hdr = pattern_item_header[last_item_type];
 		assert(item_hdr);
 
-- 
2.25.1


             reply	other threads:[~2022-08-23 10:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 10:57 Amit Prakash Shukla [this message]
2022-08-23 10:57 ` [PATCH 2/3] net/qede/base: compilation fix for GCC-12 Amit Prakash Shukla
2022-08-23 10:57 ` [PATCH 3/3] examples/ipsec-secgw: " Amit Prakash Shukla
2022-08-23 13:12   ` Akhil Goyal
2022-08-24 14:03 ` [PATCH 1/2] net/i40e: " Amit Prakash Shukla
2022-08-24 14:03   ` [PATCH 2/2] net/qede/base: " Amit Prakash Shukla
2022-10-06  9:52     ` Thomas Monjalon
2022-08-25  7:21   ` [PATCH 1/2] net/i40e: " Morten Brørup
2022-08-26  9:45   ` Amit Prakash Shukla
2022-08-26 10:32     ` Morten Brørup
2022-10-06  9:51   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220823105742.2276506-1-amitprakashs@marvell.com \
    --to=amitprakashs@marvell.com \
    --cc=Yuying.Zhang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.