aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorxypron.glpk@gmx.de2017-05-16 05:07:01 +0200
committerJoe Hershberger2017-06-02 14:44:19 -0500
commitc08248d601e939ababe1642d11be63d0c14c7d1a (patch)
treed7a9a4232cc9720b7f51129a10632e8e5c90d400 /net
parent96d1d84c79b63e5882f09be451227f7145ea8599 (diff)
net: core: avoid possible NULL pointer dereference
Checking if dev is NULL after dereferencing it does not make sense. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net')
-rw-r--r--net/eth-uclass.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index c3cc3152a28..b659961a5dd 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -181,7 +181,7 @@ int eth_get_dev_index(void)
static int eth_write_hwaddr(struct udevice *dev)
{
- struct eth_pdata *pdata = dev->platdata;
+ struct eth_pdata *pdata;
int ret = 0;
if (!dev || !device_active(dev))
@@ -189,6 +189,7 @@ static int eth_write_hwaddr(struct udevice *dev)
/* seq is valid since the device is active */
if (eth_get_ops(dev)->write_hwaddr && !eth_mac_skip(dev->seq)) {
+ pdata = dev->platdata;
if (!is_valid_ethaddr(pdata->enetaddr)) {
printf("\nError: %s address %pM illegal value\n",
dev->name, pdata->enetaddr);