Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mbuf: fix strict aliasing in allocator
When building an application with -fstrict-aliasing -Wstrict-aliasing=2, we get errors triggered by rte_mbuf_raw_alloc() which is called inline from rte_pktmbuf_alloc(). ../dpdk/lib/mbuf/rte_mbuf.h: In function ‘rte_mbuf_raw_alloc’: ../dpdk/lib/mbuf/rte_mbuf.h:600:42: error: dereferencing type-punned pointer might break strict-aliasing rules [-Werror=strict-aliasing] 600 | if (rte_mempool_get(mp, (void **)&m) < 0) | ^~ Avoid incorrect casting by using an inline union variable. Signed-off-by: Robin Jarry <rjarry@redhat.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Tested-by: Ali Alnubani <alialnu@nvidia.com>
- Loading branch information