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]
Date:   Thu, 30 Jul 2020 12:24:07 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Kurt Kanzenbach <kurt@...utronix.de>
Cc:     Grygorii Strashko <grygorii.strashko@...com>,
        Richard Cochran <richardcochran@...il.com>,
        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>,
        Networking <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 at 11:41 AM Kurt Kanzenbach <kurt@...utronix.de> wrote:
> 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.

I think for traditional reasons, code in net/* tends to use ntohs()
while code in drivers/*  tends to use be16_to_cpu().

In drivers/net/* the two are used roughly the same, though I guess
one could make the argument that be16_to_cpu() would be
more appropriate for data structures exchanged with hardware
while ntohs() makes sense on data structures sent over the
network.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ