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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Mar 22 01:41:38 CET 2023


Hi,

FYI, your patch has been queued to stable release 20.11.8

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/23/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/9bbcaea1b25828632afe2bb44d1f3a565e00d8dc

Thanks.

Luca Boccassi

---
>From 9bbcaea1b25828632afe2bb44d1f3a565e00d8dc 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

[ 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/librte_ring/rte_ring_elem.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/librte_ring/rte_ring_elem.h b/lib/librte_ring/rte_ring_elem.h
index b79ba5cb7f..0685969d14 100644
--- a/lib/librte_ring/rte_ring_elem.h
+++ b/lib/librte_ring/rte_ring_elem.h
@@ -104,6 +104,12 @@ ssize_t rte_ring_get_memsize_elem(unsigned int esize, unsigned int count);
 struct rte_ring *rte_ring_create_elem(const char *name, unsigned int esize,
 			unsigned int count, int socket_id, unsigned int flags);
 
+#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)
@@ -1076,6 +1082,10 @@ rte_ring_dequeue_burst_elem(struct rte_ring *r, void *obj_table,
 	return 0;
 }
 
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000)
+#pragma GCC diagnostic pop
+#endif
+
 #ifdef ALLOW_EXPERIMENTAL_API
 #include <rte_ring_peek.h>
 #include <rte_ring_peek_zc.h>
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-21 21:56:37.147319081 +0000
+++ 0002-ring-silence-GCC-12-warnings.patch	2023-03-21 21:56:37.004805629 +0000
@@ -1 +1 @@
-From dea4c5415506b3c1996cc56dcf15ffb5f6f1d49c Mon Sep 17 00:00:00 2001
+From 9bbcaea1b25828632afe2bb44d1f3a565e00d8dc Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit dea4c5415506b3c1996cc56dcf15ffb5f6f1d49c ]
+
@@ -32,2 +33,0 @@
-Cc: stable at dpdk.org
-
@@ -37 +37 @@
- lib/ring/rte_ring_elem_pvt.h | 10 ++++++++++
+ lib/librte_ring/rte_ring_elem.h | 10 ++++++++++
@@ -40,7 +40,7 @@
-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_
+diff --git a/lib/librte_ring/rte_ring_elem.h b/lib/librte_ring/rte_ring_elem.h
+index b79ba5cb7f..0685969d14 100644
+--- a/lib/librte_ring/rte_ring_elem.h
++++ b/lib/librte_ring/rte_ring_elem.h
+@@ -104,6 +104,12 @@ ssize_t rte_ring_get_memsize_elem(unsigned int esize, unsigned int count);
+ struct rte_ring *rte_ring_create_elem(const char *name, unsigned int esize,
+ 			unsigned int count, int socket_id, unsigned int flags);
@@ -57,2 +57,2 @@
-@@ -382,4 +388,8 @@ end:
- 	return n;
+@@ -1076,6 +1082,10 @@ rte_ring_dequeue_burst_elem(struct rte_ring *r, void *obj_table,
+ 	return 0;
@@ -65 +65,3 @@
- #endif /* _RTE_RING_ELEM_PVT_H_ */
+ #ifdef ALLOW_EXPERIMENTAL_API
+ #include <rte_ring_peek.h>
+ #include <rte_ring_peek_zc.h>


More information about the stable mailing list