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]
Message-ID: <8b16d2b4-ef5c-4906-b094-840150980dc1@lunn.ch>
Date: Wed, 3 Apr 2024 22:58:37 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Alexander Duyck <alexander.duyck@...il.com>
Cc: netdev@...r.kernel.org, Alexander Duyck <alexanderduyck@...com>,
	kuba@...nel.org, davem@...emloft.net, pabeni@...hat.com
Subject: Re: [net-next PATCH 07/15] eth: fbnic: allocate a netdevice and napi
 vectors with queues

> +static int fbnic_dsn_to_mac_addr(u64 dsn, char *addr)
> +{
> +	addr[0] = (dsn >> 56) & 0xFF;
> +	addr[1] = (dsn >> 48) & 0xFF;
> +	addr[2] = (dsn >> 40) & 0xFF;
> +	addr[3] = (dsn >> 16) & 0xFF;
> +	addr[4] = (dsn >> 8) & 0xFF;
> +	addr[5] = dsn & 0xFF;

u64_to_ether_addr() might work here.

> +
> +	return is_valid_ether_addr(addr) ? 0 : -EINVAL;
> +}
> +
> +/**
> + * fbnic_netdev_register - Initialize general software structures
> + * @netdev: Netdev containing structure to initialize and register
> + *
> + * Initialize the MAC address for the netdev and register it.
> + **/
> +int fbnic_netdev_register(struct net_device *netdev)
> +{
> +	struct fbnic_net *fbn = netdev_priv(netdev);
> +	struct fbnic_dev *fbd = fbn->fbd;
> +	u64 dsn = fbd->dsn;
> +	u8 addr[ETH_ALEN];
> +	int err;
> +
> +	err = fbnic_dsn_to_mac_addr(dsn, addr);
> +	if (!err) {
> +		ether_addr_copy(netdev->perm_addr, addr);
> +		eth_hw_addr_set(netdev, addr);
> +	} else {
> +		dev_err(fbd->dev, "MAC addr %pM invalid\n", addr);

Rather than fail, it is more normal to allocate a random MAC address.

> @@ -192,7 +266,6 @@ static int fbnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  
>  	fbnic_devlink_unregister(fbd);
>  	fbnic_devlink_free(fbd);
> -
>  	return err;
>  }

That hunk should be somewhere else.

     Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ