lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  3 Aug 2020 13:57:24 +0200 (CEST)
From:   Michal Kubecek <mkubecek@...e.cz>
To:     netdev@...r.kernel.org
Subject: [PATCH ethtool 7/7] ioctl: avoid zero length array warning in
 get_stringset()

Starting with gcc10, gcc issues a warning about accessing elements of
zero leghth arrays. This is usually fixed by using C99 variable length
arrays but struct ethtool_sset_info is part of kernel UAPI so use an
auxiliary pointer instead.

Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
---
 ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ethtool.c b/ethtool.c
index 0f312bdae2bb..c4ad186cd390 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1632,7 +1632,9 @@ get_stringset(struct cmd_context *ctx, enum ethtool_stringset set_id,
 	sset_info.hdr.reserved = 0;
 	sset_info.hdr.sset_mask = 1ULL << set_id;
 	if (send_ioctl(ctx, &sset_info) == 0) {
-		len = sset_info.hdr.sset_mask ? sset_info.hdr.data[0] : 0;
+		const u32 *sset_lengths = sset_info.hdr.data;
+
+		len = sset_info.hdr.sset_mask ? sset_lengths[0] : 0;
 	} else if (errno == EOPNOTSUPP && drvinfo_offset != 0) {
 		/* Fallback for old kernel versions */
 		drvinfo.cmd = ETHTOOL_GDRVINFO;
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ