* [PATCH] drivers: net: fsl_ls_mdio: prevent a NULL pointer dereference
@ 2023-01-05 15:09 Ioana Ciornei
2023-01-10 17:09 ` Ramon Fried
2023-02-03 18:20 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Ioana Ciornei @ 2023-01-05 15:09 UTC (permalink / raw)
To: joe.hershberger, rfried.dev, u-boot; +Cc: Ioana Ciornei
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>
---
drivers/net/fsl_ls_mdio.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/fsl_ls_mdio.c b/drivers/net/fsl_ls_mdio.c
index f213e0dd8590..fce73937502d 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,
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers: net: fsl_ls_mdio: prevent a NULL pointer dereference
2023-01-05 15:09 [PATCH] drivers: net: fsl_ls_mdio: prevent a NULL pointer dereference Ioana Ciornei
@ 2023-01-10 17:09 ` Ramon Fried
2023-02-03 18:20 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Ramon Fried @ 2023-01-10 17:09 UTC (permalink / raw)
To: Ioana Ciornei; +Cc: joe.hershberger, u-boot
On Thu, Jan 5, 2023 at 5:09 PM Ioana Ciornei <ioana.ciornei@nxp.com> wrote:
>
> 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>
> ---
> drivers/net/fsl_ls_mdio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/fsl_ls_mdio.c b/drivers/net/fsl_ls_mdio.c
> index f213e0dd8590..fce73937502d 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,
> --
> 2.25.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers: net: fsl_ls_mdio: prevent a NULL pointer dereference
2023-01-05 15:09 [PATCH] drivers: net: fsl_ls_mdio: prevent a NULL pointer dereference Ioana Ciornei
2023-01-10 17:09 ` Ramon Fried
@ 2023-02-03 18:20 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2023-02-03 18:20 UTC (permalink / raw)
To: Ioana Ciornei; +Cc: joe.hershberger, rfried.dev, u-boot
[-- Attachment #1: Type: text/plain, Size: 351 bytes --]
On Thu, Jan 05, 2023 at 05:09:48PM +0200, Ioana Ciornei wrote:
> 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>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-03 18:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-05 15:09 [PATCH] drivers: net: fsl_ls_mdio: prevent a NULL pointer dereference Ioana Ciornei
2023-01-10 17:09 ` Ramon Fried
2023-02-03 18:20 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox