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: <2d6eef78762562bcbb732179b32f0fd9@walle.cc>
Date:   Mon, 05 Apr 2021 23:46:04 +0200
From:   Michael Walle <michael@...le.cc>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/2] of: net: fix of_get_mac_addr_nvmem() for PCI and DSA
 nodes

Hi Andrew,

Am 2021-04-05 23:34, schrieb Andrew Lunn:
>> -static int of_get_mac_addr_nvmem(struct device_node *np, u8 addr)
>> +static int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr)
>>  {
>>  	struct platform_device *pdev = of_find_device_by_node(np);
>> +	struct nvmem_cell *cell;
>> +	const void *mac;
>> +	size_t len;
>>  	int ret;
>> 
>> -	if (!pdev)
>> -		return -ENODEV;
>> +	/* Try lookup by device first, there might be a nvmem_cell_lookup
>> +	 * associated with a given device.
>> +	 */
>> +	if (pdev) {
>> +		ret = nvmem_get_mac_address(&pdev->dev, addr);
>> +		put_device(&pdev->dev);
>> +		return ret;
>> +	}
> 
> Can you think of any odd corner case where nvmem_get_mac_address()
> would fail, but of_nvmem_cell_get(np, "mac-address") would work?

You mean, it might make sense to just return here when
nvmem_get_mac_address() will succeed and fall back to the
of_nvmem_cell_get() in case of an error?

nvmem_get_mac_address() will first try to do the lookup by the
of_node of pdev->dev; and because np is used to find the pdev, it should
work for the same cases where of_nvmem_cell_get(np) will work.

I'm fine with either, maybe the fallback to of_nvmem_cell_get()
is clearer.

-michael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ