patch 'ring: silence GCC 12 warnings' has been queued to stable release 22.11.2

Xueming Li xuemingl at nvidia.com
Sun Apr 9 17:24:44 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/11/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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/38369a1974fb07cc59811c1a1cce494eedac24ff

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 38369a1974fb07cc59811c1a1cce494eedac24ff Mon Sep 17 00:00:00 2001
From: Kevin Traynor <ktraynor at redhat.com>
Date: Tue, 20 Dec 2022 10:52:17 +0000
Subject: [PATCH] ring: silence GCC 12 warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit dea4c5415506b3c1996cc56dcf15ffb5f6f1d49c ]

gcc 12.2.1 on Fedora 37 is giving stringop-overread and stringop-overflow
warnings when compiled with --buildtype=debug e.g. [1].

They look similar to the overflow issues previously squashed in rte_memcpy
commit b5b3ea803e47 ("eal/x86: ignore gcc 10 stringop-overflow warnings").

Squash these warnings, waiting for a cleaner fix.

[1]
lib/ring/rte_ring_elem_pvt.h:100:25: error:
	‘memcpy’ reading 32 bytes from a region of size 4
	[-Werror=stringop-overread]
100 |               memcpy((void *)(ring + idx),
    |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
101 |                       (const void *)(obj + i), 32);
    |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/ring/rte_ring_elem_pvt.h:234:25: error:
	‘memcpy’ writing 32 bytes into a region of size 4
	overflows the destination [-Werror=stringop-overflow=]
234 |               memcpy((void *)(obj + i), (void *)(ring + idx), 32);
    |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 lib/ring/rte_ring_elem_pvt.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/ring/rte_ring_elem_pvt.h b/lib/ring/rte_ring_elem_pvt.h
index 83788c56e6..e24e4492ff 100644
--- a/lib/ring/rte_ring_elem_pvt.h
+++ b/lib/ring/rte_ring_elem_pvt.h
@@ -10,6 +10,12 @@
 #ifndef _RTE_RING_ELEM_PVT_H_
 #define _RTE_RING_ELEM_PVT_H_
 
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+#pragma GCC diagnostic ignored "-Wstringop-overread"
+#endif
+
 static __rte_always_inline void
 __rte_ring_enqueue_elems_32(struct rte_ring *r, const uint32_t size,
 		uint32_t idx, const void *obj_table, uint32_t n)
@@ -382,4 +388,8 @@ end:
 	return n;
 }
 
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000)
+#pragma GCC diagnostic pop
+#endif
+
 #endif /* _RTE_RING_ELEM_PVT_H_ */
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-04-09 21:45:41.223734000 +0800
+++ 0096-ring-silence-GCC-12-warnings.patch	2023-04-09 21:45:38.719042200 +0800
@@ -1 +1 @@
-From dea4c5415506b3c1996cc56dcf15ffb5f6f1d49c Mon Sep 17 00:00:00 2001
+From 38369a1974fb07cc59811c1a1cce494eedac24ff Mon Sep 17 00:00:00 2001
@@ -7,0 +8,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit dea4c5415506b3c1996cc56dcf15ffb5f6f1d49c ]
@@ -31,2 +33,0 @@
-
-Cc: stable at dpdk.org


More information about the stable mailing list