patch 'mbuf: avoid cast-align warning in data offset macro' has been queued to stable release 19.11.11

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Tue Nov 30 17:35:03 CET 2021


Hi,

FYI, your patch has been queued to stable release 19.11.11

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before December 10th 2021. 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/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/6c88235a91df0cc538d8035870eb8fbdb52e0b55

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From 6c88235a91df0cc538d8035870eb8fbdb52e0b55 Mon Sep 17 00:00:00 2001
From: Eli Britstein <elibr at nvidia.com>
Date: Thu, 21 Oct 2021 11:51:31 +0300
Subject: [PATCH] mbuf: avoid cast-align warning in data offset macro

[ upstream commit da0333c8790b365c6aa8665888a20253c4166bfe ]

In rte_pktmbuf_mtod_offset macro, there is a casting from char * to type
't', which may cause cast-align warning when using strict cast align
flag with supporting gcc:
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
CFLAGS="-Wcast-align=strict" make V=1 -C examples/l2fwd clean static

main.c: In function 'l2fwd_mac_updating':
/dpdk/build/include/rte_mbuf_core.h:719:3: warning: cast increases
required alignment of target type [-Wcast-align]
  719 |  ((t)((char *)(m)->buf_addr + (m)->data_off + (o)))
      |   ^
/dpdk/build/include/rte_mbuf_core.h:733:32: note: in expansion of macro
'rte_pktmbuf_mtod_offset'
  733 | #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)
      |                                ^~~~~~~~~~~~~~~~~~~~~~~

As the code assumes correct alignment, add first a (void *) casting, to
avoid the warning.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Eli Britstein <elibr at nvidia.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
---
 lib/librte_mbuf/rte_mbuf_core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
index e7f38422e7..b97b811366 100644
--- a/lib/librte_mbuf/rte_mbuf_core.h
+++ b/lib/librte_mbuf/rte_mbuf_core.h
@@ -739,7 +739,7 @@ struct rte_mbuf_ext_shared_info {
  *   The type to cast the result into.
  */
 #define rte_pktmbuf_mtod_offset(m, t, o)	\
-	((t)((char *)(m)->buf_addr + (m)->data_off + (o)))
+	((t)(void *)((char *)(m)->buf_addr + (m)->data_off + (o)))
 
 /**
  * A macro that points to the start of the data in the mbuf.
-- 
2.34.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-30 16:50:11.606680909 +0100
+++ 0099-mbuf-avoid-cast-align-warning-in-data-offset-macro.patch	2021-11-30 16:50:05.898874322 +0100
@@ -1 +1 @@
-From da0333c8790b365c6aa8665888a20253c4166bfe Mon Sep 17 00:00:00 2001
+From 6c88235a91df0cc538d8035870eb8fbdb52e0b55 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit da0333c8790b365c6aa8665888a20253c4166bfe ]
+
@@ -26 +27,0 @@
-Cc: stable at dpdk.org
@@ -31 +32 @@
- lib/mbuf/rte_mbuf_core.h | 2 +-
+ lib/librte_mbuf/rte_mbuf_core.h | 2 +-
@@ -34,5 +35,5 @@
-diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
-index 117a72a134..321a419c71 100644
---- a/lib/mbuf/rte_mbuf_core.h
-+++ b/lib/mbuf/rte_mbuf_core.h
-@@ -823,7 +823,7 @@ struct rte_mbuf_ext_shared_info {
+diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
+index e7f38422e7..b97b811366 100644
+--- a/lib/librte_mbuf/rte_mbuf_core.h
++++ b/lib/librte_mbuf/rte_mbuf_core.h
+@@ -739,7 +739,7 @@ struct rte_mbuf_ext_shared_info {


More information about the stable mailing list