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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ime5ny3e.fsf@kurt>
Date:   Thu, 30 Jul 2020 11:36:37 +0200
From:   Kurt Kanzenbach <kurt@...utronix.de>
To:     Grygorii Strashko <grygorii.strashko@...com>,
        Richard Cochran <richardcochran@...il.com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Jiri Pirko <jiri@...lanox.com>,
        Ido Schimmel <idosch@...lanox.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org>,
        Samuel Zou <zou_wei@...wei.com>, netdev@...r.kernel.org,
        Petr Machata <petrm@...lanox.com>
Subject: Re: [PATCH v3 5/9] ethernet: ti: am65-cpts: Use generic helper function

On Thu Jul 30 2020, Grygorii Strashko wrote:
> On 30/07/2020 11:00, Kurt Kanzenbach wrote:
>> +	msgtype = ptp_get_msgtype(hdr, ptp_class);
>> +	seqid	= be16_to_cpu(hdr->sequence_id);
>
> Is there any reason to not use "ntohs()"?

This is just my personal preference, because I think it's more
readable. Internally ntohs() uses be16_to_cpu(). There's no technical
reason for it.

>
>>   
>> -	seqid = (__be16 *)(data + offset + OFF_PTP_SEQUENCE_ID);
>> -	*mtype_seqid = (*msgtype << AM65_CPTS_EVENT_1_MESSAGE_TYPE_SHIFT) &
>> +	*mtype_seqid  = (msgtype << AM65_CPTS_EVENT_1_MESSAGE_TYPE_SHIFT) &
>>   			AM65_CPTS_EVENT_1_MESSAGE_TYPE_MASK;
>> -	*mtype_seqid |= (ntohs(*seqid) & AM65_CPTS_EVENT_1_SEQUENCE_ID_MASK);
>> +	*mtype_seqid |= (seqid & AM65_CPTS_EVENT_1_SEQUENCE_ID_MASK);
>>   
>>   	return 1;
>>   }
>> 
>
> I'll try to test it today.
> Thank you.

Thanks,
Kurt

Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ