[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e443bf58c73cb382ea5f84eda9da1ea00ebf44c0.camel@microchip.com>
Date: Tue, 20 Apr 2021 12:54:14 +0000
From: <Steen.Hegelund@...rochip.com>
To: <kuba@...nel.org>
CC: <andrew@...n.ch>, <masahiroy@...nel.org>,
<Bjarni.Jonasson@...rochip.com>, <davem@...emloft.net>,
<linux-kernel@...r.kernel.org>, <UNGLinuxDriver@...rochip.com>,
<alexandre.belloni@...tlin.com>, <linux@...linux.org.uk>,
<Lars.Povlsen@...rochip.com>, <arnd@...db.de>,
<p.zabel@...gutronix.de>, <simon.horman@...ronome.com>,
<linux-arm-kernel@...ts.infradead.org>, <netdev@...r.kernel.org>,
<mark.einon@...il.com>, <madalin.bucur@....nxp.com>
Subject: Re: [PATCH net-next 03/10] net: sparx5: add hostmode with phylink
support
Hi Jacub,
On Fri, 2021-04-16 at 14:22 -0700, Jakub Kicinski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On Fri, 16 Apr 2021 15:16:50 +0200 Steen Hegelund wrote:
> > +static int sparx5_set_mac_address(struct net_device *dev, void *p)
> > +{
> > + const struct sockaddr *addr = p;
> > +
> > + /* Record the address */
> > + ether_addr_copy(dev->dev_addr, addr->sa_data);
>
> I think you need to validate that add is a valid ethernet address.
> is_valid_ether_addr()
I will add validation.
>
> > +struct net_device *sparx5_create_netdev(struct sparx5 *sparx5, u32 portno)
> > +{
> > + struct sparx5_port *spx5_port;
> > + struct net_device *ndev;
> > + u64 val;
> > +
> > + ndev = devm_alloc_etherdev(sparx5->dev, sizeof(struct sparx5_port));
> > + if (!ndev)
> > + return ERR_PTR(-ENOMEM);
> > +
> > + SET_NETDEV_DEV(ndev, sparx5->dev);
> > + spx5_port = netdev_priv(ndev);
> > + spx5_port->ndev = ndev;
> > + spx5_port->sparx5 = sparx5;
> > + spx5_port->portno = portno;
> > + sparx5_set_port_ifh(spx5_port->ifh, portno);
> > + snprintf(ndev->name, IFNAMSIZ, "eth%d", portno);
>
> Please don't try to name interfaces in the kernel.
OK. I will remove that.
Thanks for your comments.
BR
Steen
Powered by blists - more mailing lists