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:   Thu, 3 Sep 2020 18:35:34 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc:     Vadym Kochan <vadym.kochan@...ision.eu>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Jiri Pirko <jiri@...lanox.com>,
        Ido Schimmel <idosch@...lanox.com>,
        Andrew Lunn <andrew@...n.ch>,
        Oleksandr Mazur <oleksandr.mazur@...ision.eu>,
        Serhiy Boiko <serhiy.boiko@...ision.eu>,
        Serhiy Pshyk <serhiy.pshyk@...ision.eu>,
        Volodymyr Mytnyk <volodymyr.mytnyk@...ision.eu>,
        Taras Chornyi <taras.chornyi@...ision.eu>,
        Andrii Savka <andrii.savka@...ision.eu>,
        Network Development <netdev@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Mickey Rachamim <mickeyr@...vell.com>
Subject: Re: [PATCH net v6 1/6] net: marvell: prestera: Add driver for
 Prestera family ASIC devices

On Thu, Sep 3, 2020 at 6:23 PM Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
> On Wed, Sep 2, 2020 at 5:37 PM Vadym Kochan <vadym.kochan@...ision.eu> wrote:

...

> > +static int prestera_is_valid_mac_addr(struct prestera_port *port, u8 *addr)
> > +{
> > +       if (!is_valid_ether_addr(addr))
> > +               return -EADDRNOTAVAIL;
> > +
> > +       if (memcmp(port->sw->base_mac, addr, ETH_ALEN - 1))
>
> Why ETH_ALEN - 1?

We even have a lot of helpers specifically for ethernet MACs.
Starting from [1] till almost the end of the file. Here [2] can be
used (or its unaligned counterpart).

[1]: https://elixir.bootlin.com/linux/latest/source/include/linux/etherdevice.h#L67
[2]: https://elixir.bootlin.com/linux/latest/source/include/linux/etherdevice.h#L67

> > +               return -EINVAL;
> > +
> > +       return 0;
> > +}

> > +       memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
>
> Is addr_len ever not ETH_ALEN for this device?

And if it is ETH_ALEN, here is [3].
[3]: https://elixir.bootlin.com/linux/latest/source/include/linux/etherdevice.h#L287

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ