From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Beilei Xing <beilei.xing@intel.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
dev@dpdk.org, Qi Z Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH] net/i40e: fix build for 32-bit
Date: Fri, 29 Oct 2021 11:37:01 +0100 [thread overview]
Message-ID: <20211029103701.4094508-1-ferruh.yigit@intel.com> (raw)
Got error with: gcc 11.2.1 "cc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)"
Build error:
In function ‘i40e_flow_parse_fdir_pattern’,
inlined from ‘i40e_flow_parse_fdir_filter’
at ../drivers/net/i40e/i40e_flow.c:3274:8:
../drivers/net/i40e/i40e_flow.c:3052:69:
error: writing 1 byte into a region of size 0
[-Werror=stringop-overflow=]
3052 | filter->input.flow_ext.flexbytes[j] =
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
3053 | raw_spec->pattern[i];
| ~~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/net/i40e/i40e_flow.c:25:
../drivers/net/i40e/i40e_flow.c:
In function ‘i40e_flow_parse_fdir_filter’:
../drivers/net/i40e/i40e_ethdev.h:638:17:
note: at offset 16 into destination object ‘flexbytes’ of size 16
638 | uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
| ^~~~~~~~~
Fixing by adding range checks.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Qi Z Zhang <qi.z.zhang@intel.com>
Not sure why only 32-bit is causing this error, or if the overflow
practically can occurs.
./devtools/test-meson-builds.sh is not catching the warning because of
'--buildtype=debugoptimized'.
I can reproduce in my environment as following:
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig meson --werror -Dc_args=-m32
-Dc_link_args=-m32 build && ninja -C build
---
drivers/net/i40e/i40e_flow.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 9acaa1875105..c9676caab5dd 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -3049,6 +3049,9 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
for (i = 0; i < raw_spec->length; i++) {
j = i + next_dst_off;
+ if (j >= RTE_ETH_FDIR_MAX_FLEXLEN ||
+ j >= I40E_FDIR_MAX_FLEX_LEN)
+ break;
filter->input.flow_ext.flexbytes[j] =
raw_spec->pattern[i];
filter->input.flow_ext.flex_mask[j] =
--
2.31.1
next reply other threads:[~2021-10-29 10:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 10:37 Ferruh Yigit [this message]
2021-11-01 1:15 ` Zhang, Qi Z
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=20211029103701.4094508-1-ferruh.yigit@intel.com \
--to=ferruh.yigit@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).