Thread (16 messages) flat view 16 messages, 3 authors, 2021-04-21

Re: [PATCH net-next 03/10] net: sparx5: add hostmode with phylink support

From: <Steen.Hegelund@microchip.com>
Date: 2021-04-20 12:54:24
Also in: linux-arm-kernel, lkml

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:
quoted
+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.
quoted
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help