patch 'ethdev: fix 32-bit build with GCC 13' has been queued to stable release 20.11.10

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Nov 8 20:25:16 CET 2023


Hi,

FYI, your patch has been queued to stable release 20.11.10

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/10/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/6cdc03899a13bacd67bdb887377f69b2993b02ca

Thanks.

Luca Boccassi

---
>From 6cdc03899a13bacd67bdb887377f69b2993b02ca Mon Sep 17 00:00:00 2001
From: Ruifeng Wang <ruifeng.wang at arm.com>
Date: Wed, 1 Nov 2023 15:15:54 +0800
Subject: [PATCH] ethdev: fix 32-bit build with GCC 13

[ upstream commit 3d67012ab70252190fcfea12c122567a4d010228 ]

aarch32 build with gcc-13.0.1 generated following warning:

In function 'memcpy',
 inlined from 'rte_memcpy' at .../eal/arm/include/rte_memcpy_32.h:296:9,
 inlined from 'rte_flow_conv_action_conf' at .../rte_flow.c:726:20,
 inlined from 'rte_flow_conv_actions' at .../ethdev/rte_flow.c:936:10:
warning: '__builtin_memcpy' specified bound 4294967264 exceeds maximum
         object size 2147483647 [-Wstringop-overflow=]

The issue is due to possible wrapping in unsigned arithmetic.
The 'size' can be 0. 'off' is 32. When 'tmp' is equal to (unsigned)-32,
the copy length is more than half the address space. Hence the warning.

Cast variables to 64-bit to avoid wrapping.

Fixes: 063911ee1df4 ("ethdev: add flow API object converter")

Reported-by: Luca Boccassi <bluca at debian.org>
Signed-off-by: Ruifeng Wang <ruifeng.wang at arm.com>
Acked-by: Ori Kam <orika at nvidia.com>
Acked-by: Ferruh Yigit <ferruh.yigit at amd.com>
---
 lib/librte_ethdev/rte_flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index a06f64c271..5a0f1feb0c 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -580,7 +580,7 @@ rte_flow_conv_action_conf(void *buf, const size_t size,
 		if (src.rss->key_len && src.rss->key) {
 			off = RTE_ALIGN_CEIL(off, sizeof(*dst.rss->key));
 			tmp = sizeof(*src.rss->key) * src.rss->key_len;
-			if (size >= off + tmp)
+			if (size >= (uint64_t)off + (uint64_t)tmp)
 				dst.rss->key = rte_memcpy
 					((void *)((uintptr_t)dst.rss + off),
 					 src.rss->key, tmp);
@@ -589,7 +589,7 @@ rte_flow_conv_action_conf(void *buf, const size_t size,
 		if (src.rss->queue_num) {
 			off = RTE_ALIGN_CEIL(off, sizeof(*dst.rss->queue));
 			tmp = sizeof(*src.rss->queue) * src.rss->queue_num;
-			if (size >= off + tmp)
+			if (size >= (uint64_t)off + (uint64_t)tmp)
 				dst.rss->queue = rte_memcpy
 					((void *)((uintptr_t)dst.rss + off),
 					 src.rss->queue, tmp);
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-11-08 19:23:52.912025432 +0000
+++ 0018-ethdev-fix-32-bit-build-with-GCC-13.patch	2023-11-08 19:23:51.785396541 +0000
@@ -1 +1 @@
-From 3d67012ab70252190fcfea12c122567a4d010228 Mon Sep 17 00:00:00 2001
+From 6cdc03899a13bacd67bdb887377f69b2993b02ca Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 3d67012ab70252190fcfea12c122567a4d010228 ]
+
@@ -22 +23,0 @@
-Cc: stable at dpdk.org
@@ -29 +30 @@
- lib/ethdev/rte_flow.c | 4 ++--
+ lib/librte_ethdev/rte_flow.c | 4 ++--
@@ -32,5 +33,5 @@
-diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
-index 4d6c28ee0e..20ee8430ea 100644
---- a/lib/ethdev/rte_flow.c
-+++ b/lib/ethdev/rte_flow.c
-@@ -724,7 +724,7 @@ rte_flow_conv_action_conf(void *buf, const size_t size,
+diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
+index a06f64c271..5a0f1feb0c 100644
+--- a/lib/librte_ethdev/rte_flow.c
++++ b/lib/librte_ethdev/rte_flow.c
+@@ -580,7 +580,7 @@ rte_flow_conv_action_conf(void *buf, const size_t size,
@@ -45 +46 @@
-@@ -733,7 +733,7 @@ rte_flow_conv_action_conf(void *buf, const size_t size,
+@@ -589,7 +589,7 @@ rte_flow_conv_action_conf(void *buf, const size_t size,


More information about the stable mailing list