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] [day] [month] [year] [list]
Date: Tue, 18 Jun 2024 09:11:27 -0700
From: Brett Creeley <bcreeley@....com>
To: David Laight <David.Laight@...LAB.COM>,
 'Shannon Nelson' <shannon.nelson@....com>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
 "davem@...emloft.net" <davem@...emloft.net>,
 "kuba@...nel.org" <kuba@...nel.org>,
 "edumazet@...gle.com" <edumazet@...gle.com>,
 "pabeni@...hat.com" <pabeni@...hat.com>
Cc: "brett.creeley@....com" <brett.creeley@....com>,
 "drivers@...sando.io" <drivers@...sando.io>
Subject: Re: [PATCH net-next 7/8] ionic: Use an u16 for rx_copybreak



On 6/18/2024 1:16 AM, David Laight wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> From: Brett Creeley
>> Sent: 17 June 2024 17:25
>>
>> On 6/15/2024 2:20 PM, David Laight wrote:
>>>
>>> From: Shannon Nelson
>>>> Sent: 11 June 2024 00:07
>>>>
>>>> From: Brett Creeley <brett.creeley@....com>
>>>>
>>>> To make space for other data members on the first cache line reduce
>>>> rx_copybreak from an u32 to u16.  The max Rx buffer size we support
>>>> is (u16)-1 anyway so this makes sense.
>>>>
>>>> Signed-off-by: Brett Creeley <brett.creeley@....com>
>>>> Signed-off-by: Shannon Nelson <shannon.nelson@....com>
>>>> ---
>>>>    drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 10 +++++++++-
>>>>    drivers/net/ethernet/pensando/ionic/ionic_lif.h     |  2 +-
>>>>    2 files changed, 10 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
>>>> b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
>>>> index 91183965a6b7..26acd82cf6bc 100644
>>>> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
>>>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
>>>> @@ -872,10 +872,18 @@ static int ionic_set_tunable(struct net_device *dev,
>>>>                              const void *data)
>>>>    {
>>>>         struct ionic_lif *lif = netdev_priv(dev);
>>>> +     u32 rx_copybreak, max_rx_copybreak;
>>>>
>>>>         switch (tuna->id) {
>>>>         case ETHTOOL_RX_COPYBREAK:
>>>> -             lif->rx_copybreak = *(u32 *)data;
>>>> +             rx_copybreak = *(u32 *)data;
>>>> +             max_rx_copybreak = min_t(u32, U16_MAX, IONIC_MAX_BUF_LEN);
>>>
>>> I doubt that needs to be min_t() or that you really need the temporary.
>>
>> IMHO the temporary variable here makes it more readable than comparing
>> directly to the casted/de-referenced opaque data pointer and then
>> assigning to the rx_copybreak member if it's a valid value.
> ...
> 
> I was thinking of the temporary for the result of min().

Yeah. I think a #define would be better yet. Thanks for pointing this out.

Brett

> 
>          David
> 
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ