dpdk/0336-net-i40e-fix-build-with-MinGW-GCC-12.patch
jiangheng12 7b9cc4c5a2 fix build with GCC 12
(cherry picked from commit d1c19aae07fc1940cea32a797e9bc9b23377f317)
2023-07-12 19:51:01 +08:00

51 lines
1.7 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 9ba87edbe69cac90bf8aff9714e3724519c633bf Mon Sep 17 00:00:00 2001
From: Amit Prakash Shukla <amitprakashs@marvell.com>
Date: Wed, 24 Aug 2022 19:33:38 +0530
Subject: [PATCH] net/i40e: fix build with MinGW GCC 12
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[ upstream commit eb440cea1e05245f362ec7fca932f2d977f12359 ]
When compiling with MinGW GCC 12,
the rte_flow_item array is seen as read out of bound:
net/i40e/i40e_hash.c:389:47: error:
array subscript 50 is above array bounds of const uint64_t[50]
{aka const long long unsigned int[50]} [-Werror=array-bounds]
389 | item_hdr = pattern_item_header[last_item_type];
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
It seems the assert check done above this line has no impact.
A real check is added to make the compiler happy.
Fixes: ef4c16fd9148 ("net/i40e: refactor RSS flow")
Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
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.23.0