]> git.baikalelectronics.ru Git - kernel.git/commit
device property: Don't overwrite addr when failing in device_get_mac_address
authorJulien Grall <julien.grall@citrix.com>
Thu, 3 Sep 2015 22:59:50 +0000 (23:59 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Sep 2015 20:40:23 +0000 (13:40 -0700)
commit7a75cce8c18f843e72ce5f61faee19c53180b28b
tree0558c3d3deace7e53bc3efbab3f17f27f73b22f0
parent1e36a7825ee68185d9de8487a4604267a9f419d7
device property: Don't overwrite addr when failing in device_get_mac_address

The function device_get_mac_address is trying different property names
in order to get the mac address. To check the return value, the variable
addr (which contain the buffer pass by the caller) will be re-used. This
means that if the previous property is not found, the next property will
be read using a NULL buffer.

Therefore it's only possible to retrieve the mac if node contains a
property "mac-address". Fix it by using a temporary buffer for the
return value.

This has been introduced by commit 9ccace7ee0afbbb7ca983112b24024a42cbae415
"Add a matching set of device_ functions for determining mac/phy"

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: David S. Miller <davem@davemloft.net>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/base/property.c