diff options
author | Ioana Ciornei <ioana.ciornei@nxp.com> | 2023-01-05 18:09:48 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-02-02 22:44:53 +0300 |
commit | 878a20aa15880e8b0cc2009331e7b207b7c668c0 (patch) | |
tree | db56063fd5261f9eb39514151574db1c75b07973 /drivers | |
parent | cfbd388ae756aac9151f21c9eb09d53f79360e6e (diff) | |
download | u-boot-878a20aa15880e8b0cc2009331e7b207b7c668c0.tar.xz |
drivers: net: fsl_ls_mdio: prevent a NULL pointer dereference
Prevent a NULL pointer dereference in the probe path by checking the
return valud of dev_read_addr_ptr() against NULL.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fsl_ls_mdio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/fsl_ls_mdio.c b/drivers/net/fsl_ls_mdio.c index f213e0dd85..fce7393750 100644 --- a/drivers/net/fsl_ls_mdio.c +++ b/drivers/net/fsl_ls_mdio.c @@ -124,6 +124,9 @@ static int fsl_ls_mdio_probe(struct udevice *dev) struct memac_mdio_controller *regs; priv->regs_base = dev_read_addr_ptr(dev); + if (!priv->regs_base) + return -ENODEV; + regs = (struct memac_mdio_controller *)(priv->regs_base); memac_setbits_32(®s->mdio_stat, |