mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Jakub Kicinski <kuba@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Michael Chan <michael.chan@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Potnuri Bharat Teja <bharat@chelsio.com>,
	Christian Benvenuti <benve@cisco.com>,
	Satish Kharat <satishkh@cisco.com>,
	Manish Chopra <manishc@marvell.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings
Date: Tue, 29 Oct 2024 10:55:14 -0600	[thread overview]
Message-ID: <f6c90a57-0cd6-4e26-9250-8a63d043e252@embeddedor.com> (raw)
In-Reply-To: <20241029065824.670f14fc@kernel.org>



On 29/10/24 07:58, Jakub Kicinski wrote:
> On Mon, 21 Oct 2024 13:02:27 -0600 Gustavo A. R. Silva wrote:
>> @@ -3025,7 +3025,7 @@ static int bnxt_set_link_ksettings(struct net_device *dev,
>>   {
>>   	struct bnxt *bp = netdev_priv(dev);
>>   	struct bnxt_link_info *link_info = &bp->link_info;
>> -	const struct ethtool_link_settings *base = &lk_ksettings->base;
>> +	const struct ethtool_link_settings_hdr *base = &lk_ksettings->base;
> 
> Please improve the variable ordering while at it. Longest list first,
> so move the @base definition first.

OK. This would end up looking like:

	const struct ethtool_link_settings_hdr *base = &lk_ksettings->base;
	struct bnxt *bp = netdev_priv(dev);
	struct bnxt_link_info *link_info = &bp->link_info;



> 
>>   	bool set_pause = false;
>>   	u32 speed, lanes = 0;
>>   	int rc = 0;
>> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
>> index 7f3f5afa864f..cc43294bdc96 100644
>> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
>> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
>> @@ -663,7 +663,7 @@ static int get_link_ksettings(struct net_device *dev,
>>   			      struct ethtool_link_ksettings *link_ksettings)
>>   {
>>   	struct port_info *pi = netdev_priv(dev);
>> -	struct ethtool_link_settings *base = &link_ksettings->base;
>> +	struct ethtool_link_settings_hdr *base = &link_ksettings->base;
> 
> ditto
> 
>>   	/* For the nonce, the Firmware doesn't send up Port State changes
>>   	 * when the Virtual Interface attached to the Port is down.  So
>> @@ -719,7 +719,7 @@ static int set_link_ksettings(struct net_device *dev,
>>   {
>>   	struct port_info *pi = netdev_priv(dev);
>>   	struct link_config *lc = &pi->link_cfg;
>> -	const struct ethtool_link_settings *base = &link_ksettings->base;
>> +	const struct ethtool_link_settings_hdr *base = &link_ksettings->base;
> 
> and here
> 
>>   	struct link_config old_lc;
>>   	unsigned int fw_caps;
>>   	int ret = 0;
>> diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
>> index 2fbe0f059a0b..0d85ac342ac7 100644
>> --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
>> +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
>> @@ -1437,7 +1437,7 @@ static int cxgb4vf_get_link_ksettings(struct net_device *dev,
>>   				  struct ethtool_link_ksettings *link_ksettings)
>>   {
>>   	struct port_info *pi = netdev_priv(dev);
>> -	struct ethtool_link_settings *base = &link_ksettings->base;
>> +	struct ethtool_link_settings_hdr *base = &link_ksettings->base;
> 
> and here
> 
>>   	/* For the nonce, the Firmware doesn't send up Port State changes
>>   	 * when the Virtual Interface attached to the Port is down.  So
>> diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
>> index f7986f2b6a17..8670eb394fad 100644
>> --- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
>> +++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
>> @@ -130,7 +130,7 @@ static int enic_get_ksettings(struct net_device *netdev,
>>   			      struct ethtool_link_ksettings *ecmd)
>>   {
>>   	struct enic *enic = netdev_priv(netdev);
>> -	struct ethtool_link_settings *base = &ecmd->base;
>> +	struct ethtool_link_settings_hdr *base = &ecmd->base;
> 
> and here
> 
>>   	ethtool_link_ksettings_add_link_mode(ecmd, supported,
>>   					     10000baseT_Full);
> 
>> @@ -62,7 +62,7 @@ static int linkmodes_reply_size(const struct ethnl_req_info *req_base,
>>   {
>>   	const struct linkmodes_reply_data *data = LINKMODES_REPDATA(reply_base);
>>   	const struct ethtool_link_ksettings *ksettings = &data->ksettings;
>> -	const struct ethtool_link_settings *lsettings = &ksettings->base;
>> +	const struct ethtool_link_settings_hdr *lsettings = &ksettings->base;
> 
> here it was correct and now its not

I don't think you want to change this. `lsettings` is based on `ksettings`. So,
`ksettings` should go first. The same scenario for the one below.

> 
>>   	bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS;
>>   	int len, ret;
>>   
>> @@ -103,7 +103,7 @@ static int linkmodes_fill_reply(struct sk_buff *skb,
>>   {
>>   	const struct linkmodes_reply_data *data = LINKMODES_REPDATA(reply_base);
>>   	const struct ethtool_link_ksettings *ksettings = &data->ksettings;
>> -	const struct ethtool_link_settings *lsettings = &ksettings->base;
>> +	const struct ethtool_link_settings_hdr *lsettings = &ksettings->base;
> 
> same
> 
>>   	bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS;
>>   	int ret;
> 


  reply	other threads:[~2024-10-29 16:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 19:01 [PATCH 0/2][next] UAPI: net/ethtool: " Gustavo A. R. Silva
2024-10-21 19:01 ` [PATCH 1/2][next] UAPI: ethtool: Use __struct_group() in struct ethtool_link_settings Gustavo A. R. Silva
2024-10-21 20:11   ` Andrew Lunn
2024-10-23 21:30     ` Gustavo A. R. Silva
2024-10-21 19:02 ` [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2024-10-28 23:21   ` Jakub Kicinski
2024-10-28 23:32     ` Gustavo A. R. Silva
2024-10-29  0:32       ` Jakub Kicinski
2024-10-29  2:37         ` Gustavo A. R. Silva
2024-10-29 13:56           ` Jakub Kicinski
2024-10-29 13:58   ` Jakub Kicinski
2024-10-29 16:55     ` Gustavo A. R. Silva [this message]
2024-10-29 18:08       ` Jakub Kicinski
2024-10-29 18:18         ` Gustavo A. R. Silva
2024-10-29 18:39           ` Jakub Kicinski
2024-10-29 18:48             ` Gustavo A. R. Silva
2024-10-29 18:54               ` Jakub Kicinski
2024-10-29 19:18                 ` Gustavo A. R. Silva
2024-10-29 20:00                   ` Jakub Kicinski
2024-10-29 22:06                     ` Gustavo A. R. Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f6c90a57-0cd6-4e26-9250-8a63d043e252@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=benve@cisco.com \
    --cc=bharat@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gustavoars@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=satishkh@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome