[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RHEL7 qemu-kvm PATCH 1/3] Fix net.c warning on GCC 11

From: mrezanin
Subject: [RHEL7 qemu-kvm PATCH 1/3] Fix net.c warning on GCC 11
Date: Mon, 11 Jan 2021 12:30:35 +0100

From: Miroslav Rezanina <mrezanin@redhat.com>

When building qemu with GCC 11, compiling eth.c file produce following warning:

   warning: array subscript 'struct ip6_ext_hdr_routing[0]' is partly outside 
array bounds of 'struct ip6_ext_hdr[1]' [-Warray-bounds]

This caused by retyping from ip6_ext_hdr to ip6_ext_hdr_routing that has more

As this usage is expected, suppress the warning temporarily through the function
using this retyping.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
 net/eth.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/eth.c b/net/eth.c
index 1e0821c5f8..b9bdd0435c 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -405,6 +405,8 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int 
                         struct ip6_ext_hdr *ext_hdr,
                         struct in6_address *dst_addr)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
     struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr;
     if ((rthdr->rtype == 2) &&
@@ -426,6 +428,7 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int 
     return false;
+#pragma GCC diagnostic pop
 static bool

reply via email to

[Prev in Thread] Current Thread [Next in Thread]