From cebd2cbfeb0634f20b0f425325c482a96fe37f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jere=20Lepp=C3=A4nen?= Date: Fri, 9 Jun 2023 11:04:45 +0300 Subject: [PATCH] linux-gen: pktio: quell array bounds warning in pedantic compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quell "array subscript 0 is outside array bounds of ‘__u32[]’" warning when compiling with GCC 13.1.1 and -Wpedantic. Signed-off-by: Jere Leppänen --- platform/linux-generic/pktio/stats/ethtool_stats.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/linux-generic/pktio/stats/ethtool_stats.c b/platform/linux-generic/pktio/stats/ethtool_stats.c index 9569ac05319..7e37da69580 100644 --- a/platform/linux-generic/pktio/stats/ethtool_stats.c +++ b/platform/linux-generic/pktio/stats/ethtool_stats.c @@ -40,7 +40,10 @@ static struct ethtool_gstrings *get_stringset(int fd, struct ifreq *ifr) hdr.sset_mask = 1ULL << ETH_SS_STATS; ifr->ifr_data = (void *)&hdr; if (ioctl(fd, SIOCETHTOOL, ifr) == 0) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" len = hdr.sset_mask ? hdr.data[0] : 0; +#pragma GCC diagnostic pop } else if (errno == EOPNOTSUPP && drvinfo_offset != 0) { /* Fallback for old kernel versions */ drvinfo.cmd = ETHTOOL_GDRVINFO;