From: Eli Britstein Date: Thu, 21 Oct 2021 08:51:30 +0000 (+0300) Subject: net: avoid cast-align warning in VLAN insert function X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a3f8d05871887d257703f6f073da002b6c568519;hp=65c2bbf41f2258fea8e1639a86598f48d8251756;p=dpdk.git net: avoid cast-align warning in VLAN insert function In rte_vlan_insert there is a casting of rte_pktmbuf_prepend returned value to (struct rte_ether_hdr *), which causes 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 In file included from main.c:35: /dpdk/build/include/rte_ether.h:370:7: warning: cast increases required alignment of target type [-Wcast-align] 370 | nh = (struct rte_ether_hdr *) | ^ As the code assumes correct alignment, add first a (void *) casting, to avoid the warning. Fixes: c974021a5949 ("ether: add soft vlan encap/decap") Cc: stable@dpdk.org Signed-off-by: Eli Britstein Acked-by: Olivier Matz --- diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h index 2c7da55b6b..1a0dbf0d60 100644 --- a/lib/net/rte_ether.h +++ b/lib/net/rte_ether.h @@ -367,7 +367,7 @@ static inline int rte_vlan_insert(struct rte_mbuf **m) return -EINVAL; oh = rte_pktmbuf_mtod(*m, struct rte_ether_hdr *); - nh = (struct rte_ether_hdr *) + nh = (struct rte_ether_hdr *)(void *) rte_pktmbuf_prepend(*m, sizeof(struct rte_vlan_hdr)); if (nh == NULL) return -ENOSPC;