[dpdk-stable] patch 'mbuf: avoid cast-align warning in data offset macro' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:31:14 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

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/12/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/96b6eaffb8c6086988726995aacbb5246a661cec

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 96b6eaffb8c6086988726995aacbb5246a661cec 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
Cc: Xueming Li <xuemingl at nvidia.com>

[ 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 c26492cf45..93a58d8cd7 100644
--- a/lib/librte_mbuf/rte_mbuf_core.h
+++ b/lib/librte_mbuf/rte_mbuf_core.h
@@ -719,7 +719,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.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:10.351487051 +0800
+++ 0190-mbuf-avoid-cast-align-warning-in-data-offset-macro.patch	2021-11-10 14:17:02.000745027 +0800
@@ -1 +1 @@
-From da0333c8790b365c6aa8665888a20253c4166bfe Mon Sep 17 00:00:00 2001
+From 96b6eaffb8c6086988726995aacbb5246a661cec Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit da0333c8790b365c6aa8665888a20253c4166bfe ]
@@ -26 +28,0 @@
-Cc: stable at dpdk.org
@@ -31 +33 @@
- lib/mbuf/rte_mbuf_core.h | 2 +-
+ lib/librte_mbuf/rte_mbuf_core.h | 2 +-
@@ -34,5 +36,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 c26492cf45..93a58d8cd7 100644
+--- a/lib/librte_mbuf/rte_mbuf_core.h
++++ b/lib/librte_mbuf/rte_mbuf_core.h
+@@ -719,7 +719,7 @@ struct rte_mbuf_ext_shared_info {


More information about the stable mailing list