On 22 Dec 2022, at 1:06, Ilya Maximets wrote:
> GCC 11+ generates a warning:
>
> In file included from lib/netdev-linux-private.h:30,
> from lib/netdev-afxdp.c:19:
> In function 'dp_packet_delete',
> inlined from 'dp_packet_delete' at lib/dp-packet.h:246:1,
> inlined from 'dp_packet_batch_add__' at lib/dp-packet.h:775:9,
> inlined from 'dp_packet_batch_add' at lib/dp-packet.h:783:5,
> inlined from 'netdev_afxdp_rxq_recv' at lib/netdev-afxdp.c:898:9:
> lib/dp-packet.h:260:9: warning: 'free' called on pointer
> '*umem.xpool.array' with nonzero offset [8, 2558044588346441168]
> [-Wfree-nonheap-object]
> 260 | free(b);
> | ^~~~~~~
>
> But it is a false positive since the code path is not possible.
> In this call chain the packet will always have source DPBUF_AFXDP
> and the free() will never be called. GCC doesn't see that, because
> initialization function dp_packet_use_afxdp() is part of a different
> translation unit.
>
> Disabling a warning in this particular place to avoid build failures.
>
> Older versions of clang do not have the -Wfree-nonheap-object, so we
> need to additionally guard the pragmas. Clang is using GCC pragmas
> and complains about unknown ones.
>
> Reported-at: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108187
> Signed-off-by: Ilya Maximets <[email protected]>
> ---
Looks good to me.
Acked-by: Eelco Chaudron <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev