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, 8 Mar 2021 07:39:29 -0600
From:   Alex Elder <elder@...aro.org>
To:     David Laight <David.Laight@...LAB.COM>,
        "subashab@...eaurora.org" <subashab@...eaurora.org>,
        "stranche@...eaurora.org" <stranche@...eaurora.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>
Cc:     "sharathv@...eaurora.org" <sharathv@...eaurora.org>,
        "bjorn.andersson@...aro.org" <bjorn.andersson@...aro.org>,
        "evgreen@...omium.org" <evgreen@...omium.org>,
        "cpratapa@...eaurora.org" <cpratapa@...eaurora.org>,
        "elder@...nel.org" <elder@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next v2 5/6] net: qualcomm: rmnet: don't use C
 bit-fields in rmnet checksum trailer

On 3/8/21 4:13 AM, David Laight wrote:
> From: Alex Elder
>> Sent: 06 March 2021 03:16
>>
>> Replace the use of C bit-fields in the rmnet_map_dl_csum_trailer
>> structure with a single one-byte field, using constant field masks
>> to encode or get at embedded values.
>>
>> Signed-off-by: Alex Elder <elder@...aro.org>
>> Reviewed-by: Bjorn Andersson <bjorn.andersson@...aro.org>
>> ---
>>   .../ethernet/qualcomm/rmnet/rmnet_map_data.c    |  2 +-
>>   include/linux/if_rmnet.h                        | 17 +++++++----------
>>   2 files changed, 8 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
>> b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
>> index 3291f252d81b0..29d485b868a65 100644
>> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
>> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
>> @@ -365,7 +365,7 @@ int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)
>>
>>   	csum_trailer = (struct rmnet_map_dl_csum_trailer *)(skb->data + len);
>>
>> -	if (!csum_trailer->valid) {
>> +	if (!u8_get_bits(csum_trailer->flags, MAP_CSUM_DL_VALID_FMASK)) {
> 
> Is that just an overcomplicated way of saying:
> 	if (!(csum_trailer->flags & MAP_CSUM_DL_VALID_FMASK)) {

Yes it is.  I defined and used all the field masks in a
consistent way, but I do think it will read better the
way you suggest.  Bjorn also asked me privately whether
GENMASK(15, 15) was just the same as BIT(15) (it is).

I will post version 3 of the series, identifying which
fields are single bit/Boolean.  For those I will define
the value using BIT() and will set/extract using simple
AND/OR operators.  I won't use the _FMASK suffix on such
fields.

Thanks a lot for your comment/question/suggestion.  I
like it.

					-Alex

>      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