Merge pull request #15762 from keszybz/gcc-10-build

Fix build with -O3 with gcc 10
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-05-11 19:43:40 +02:00
committed by GitHub
3 changed files with 20 additions and 6 deletions
+10
View File
@@ -256,8 +256,13 @@ int ethtool_get_permanent_macaddr(int *ethtool_fd, const char *ifname, struct et
if (epaddr.addr.size != 6)
return -EOPNOTSUPP;
#pragma GCC diagnostic push
#if HAVE_ZERO_LENGTH_BOUNDS
# pragma GCC diagnostic ignored "-Wzero-length-bounds"
#endif
for (size_t i = 0; i < epaddr.addr.size; i++)
ret->ether_addr_octet[i] = epaddr.addr.data[i];
#pragma GCC diagnostic pop
return 0;
}
@@ -485,7 +490,12 @@ static int get_stringset(int ethtool_fd, struct ifreq *ifr, int stringset_id, st
if (!buffer.info.sset_mask)
return -EINVAL;
#pragma GCC diagnostic push
#if HAVE_ZERO_LENGTH_BOUNDS
# pragma GCC diagnostic ignored "-Wzero-length-bounds"
#endif
len = buffer.info.data[0];
#pragma GCC diagnostic pop
strings = malloc0(sizeof(struct ethtool_gstrings) + len * ETH_GSTRING_LEN);
if (!strings)