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, 2 May 2019 11:05:38 +0200
From:   Petr Štetiar <ynezz@...e.cz>
To:     Rob Herring <robh@...nel.org>
Cc:     netdev@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Frank Rowand <frowand.list@...il.com>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Alban Bedel <albeu@...e.fr>, Felix Fietkau <nbd@....name>,
        John Crispin <john@...ozen.org>
Subject: Re: [PATCH v2 1/4] of_net: Add NVMEM support to of_get_mac_address

Rob Herring <robh@...nel.org> [2019-05-01 15:19:25]:

Hi Rob,

> > +	struct property *pp;

...

> > +	pp = kzalloc(sizeof(*pp), GFP_KERNEL);
> > +	if (!pp)
> > +		return NULL;
> > +
> > +	pp->name = "nvmem-mac-address";
> > +	pp->length = ETH_ALEN;
> > +	pp->value = kmemdup(mac, ETH_ALEN, GFP_KERNEL);
> > +	if (!pp->value || of_add_property(np, pp))
> > +		goto free;
> 
> Why add this to the DT?

I've just carried it over from v1 ("of_net: add mtd-mac-address support to
of_get_mac_address()")[1] as nobody objected about this so far. 

Honestly I don't know if it's necessary to have it, but so far address,
mac-address and local-mac-address properties provide this DT nodes, so I've
simply thought, that it would be good to have it for MAC address from NVMEM as
well in order to stay consistent.

Just FYI, my testing ar9331_8dev_carambola2.dts[2] currently produces
following runtime DT content:

 root@...nWrt:/# find /sys/firmware/devicetree/ -name *nvmem* -o -name *addr@*
 /sys/firmware/devicetree/base/ahb/spi@...00000/flash@...artitions/partition@...000/nvmem-cells
 /sys/firmware/devicetree/base/ahb/spi@...00000/flash@...artitions/partition@...000/nvmem-cells/eth-mac-addr@0
 /sys/firmware/devicetree/base/ahb/spi@...00000/flash@...artitions/partition@...000/nvmem-cells/eth-mac-addr@6
 /sys/firmware/devicetree/base/ahb/spi@...00000/flash@...artitions/partition@...000/nvmem-cells/wifi-mac-addr@...2
 /sys/firmware/devicetree/base/ahb/wmac@...00000/nvmem-cells
 /sys/firmware/devicetree/base/ahb/wmac@...00000/nvmem-mac-address
 /sys/firmware/devicetree/base/ahb/wmac@...00000/nvmem-cell-names
 /sys/firmware/devicetree/base/ahb/eth@...00000/nvmem-cells
 /sys/firmware/devicetree/base/ahb/eth@...00000/nvmem-mac-address
 /sys/firmware/devicetree/base/ahb/eth@...00000/nvmem-cell-names
 /sys/firmware/devicetree/base/ahb/eth@...00000/nvmem-cells
 /sys/firmware/devicetree/base/ahb/eth@...00000/nvmem-mac-address
 /sys/firmware/devicetree/base/ahb/eth@...00000/nvmem-cell-names

 root@...nWrt:/# hexdump -C /sys/firmware/devicetree/base/ahb/wmac@...00000/nvmem-mac-address
 00000000  00 03 7f 11 52 da                                 |....R.|
 00000006

 root@...nWrt:/# ip addr show wlan0
 4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:03:7f:11:52:da brd ff:ff:ff:ff:ff:ff

1. https://patchwork.ozlabs.org/patch/1086628/
2. https://git.openwrt.org/?p=openwrt/staging/ynezz.git;a=blob;f=target/linux/ath79/dts/ar9331_8dev_carambola2.dts;h=349c91e760ca5a56d65c587c949fed5fb6ea980e;hb=349c91e760ca5a56d65c587c949fed5fb6ea980e

> You have the struct device ptr, so just use devm_kzalloc() if you need an
> allocation.

I'll address this in v3, thanks.

-- ynezz

Powered by blists - more mailing lists