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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 16 Feb 2024 09:08:53 -0500
From: Denis Kirjanov <kirjanov@...il.com>
To: mkubecek@...e.cz
Cc: netdev@...r.kernel.org,
	Denis Kirjanov <dkirjanov@...e.de>
Subject: [PATCH ethtool] move variable-sized members to the end of structs

The patch fixes the following clang warnings:

warning: field 'xxx' with variable sized type 'xxx' not at the end of a struct
 or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]

Signed-off-by: Denis Kirjanov <dkirjanov@...e.de>
---
 ethtool.c  | 18 +++++++++---------
 internal.h |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ethtool.c b/ethtool.c
index 3ac15a7..32e79ae 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1736,8 +1736,8 @@ get_stringset(struct cmd_context *ctx, enum ethtool_stringset set_id,
 	      ptrdiff_t drvinfo_offset, int null_terminate)
 {
 	struct {
-		struct ethtool_sset_info hdr;
 		u32 buf[1];
+		struct ethtool_sset_info hdr;
 	} sset_info;
 	struct ethtool_drvinfo drvinfo;
 	u32 len, i;
@@ -2683,8 +2683,8 @@ do_ioctl_glinksettings(struct cmd_context *ctx)
 {
 	int err;
 	struct {
-		struct ethtool_link_settings req;
 		__u32 link_mode_data[3 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];
+		struct ethtool_link_settings req;
 	} ecmd;
 	struct ethtool_link_usettings *link_usettings;
 	unsigned int u32_offs;
@@ -2752,8 +2752,8 @@ do_ioctl_slinksettings(struct cmd_context *ctx,
 		       const struct ethtool_link_usettings *link_usettings)
 {
 	struct {
-		struct ethtool_link_settings req;
 		__u32 link_mode_data[3 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];
+		struct ethtool_link_settings req;
 	} ecmd;
 	unsigned int u32_offs;
 
@@ -5206,8 +5206,8 @@ static int do_get_phy_tunable(struct cmd_context *ctx)
 
 	if (!strcmp(argp[0], "downshift")) {
 		struct {
-			struct ethtool_tunable ds;
 			u8 count;
+			struct ethtool_tunable ds;
 		} cont;
 
 		cont.ds.cmd = ETHTOOL_PHY_GTUNABLE;
@@ -5224,8 +5224,8 @@ static int do_get_phy_tunable(struct cmd_context *ctx)
 			fprintf(stdout, "Downshift disabled\n");
 	} else if (!strcmp(argp[0], "fast-link-down")) {
 		struct {
-			struct ethtool_tunable fld;
 			u8 msecs;
+			struct ethtool_tunable fld;
 		} cont;
 
 		cont.fld.cmd = ETHTOOL_PHY_GTUNABLE;
@@ -5246,8 +5246,8 @@ static int do_get_phy_tunable(struct cmd_context *ctx)
 				cont.msecs);
 	} else if (!strcmp(argp[0], "energy-detect-power-down")) {
 		struct {
-			struct ethtool_tunable ds;
 			u16 msecs;
+			struct ethtool_tunable ds;
 		} cont;
 
 		cont.ds.cmd = ETHTOOL_PHY_GTUNABLE;
@@ -5494,8 +5494,8 @@ static int do_set_phy_tunable(struct cmd_context *ctx)
 	/* Do it */
 	if (ds_changed) {
 		struct {
-			struct ethtool_tunable ds;
 			u8 count;
+			struct ethtool_tunable ds;
 		} cont;
 
 		cont.ds.cmd = ETHTOOL_PHY_STUNABLE;
@@ -5510,8 +5510,8 @@ static int do_set_phy_tunable(struct cmd_context *ctx)
 		}
 	} else if (fld_changed) {
 		struct {
-			struct ethtool_tunable fld;
 			u8 msecs;
+			struct ethtool_tunable fld;
 		} cont;
 
 		cont.fld.cmd = ETHTOOL_PHY_STUNABLE;
@@ -5526,8 +5526,8 @@ static int do_set_phy_tunable(struct cmd_context *ctx)
 		}
 	} else if (edpd_changed) {
 		struct {
-			struct ethtool_tunable fld;
 			u16 msecs;
+			struct ethtool_tunable fld;
 		} cont;
 
 		cont.fld.cmd = ETHTOOL_PHY_STUNABLE;
diff --git a/internal.h b/internal.h
index 4b994f5..e0beec6 100644
--- a/internal.h
+++ b/internal.h
@@ -152,12 +152,12 @@ struct ethtool_link_usettings {
 	struct {
 		__u8 transceiver;
 	} deprecated;
-	struct ethtool_link_settings base;
 	struct {
 		ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
 		ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
 		ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
 	} link_modes;
+	struct ethtool_link_settings base;
 };
 
 #define ethtool_link_mode_for_each_u32(index)			\
-- 
2.30.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ