* [PATCH 1/1] firmware: smci: possible NULL dereference
@ 2021-02-01 2:01 Heinrich Schuchardt
2021-02-01 20:44 ` Simon Glass
2021-02-04 1:53 ` Simon Glass
0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2021-02-01 2:01 UTC (permalink / raw)
To: u-boot
sandbox_scmi_devices_ctx() may return NULL. We should not dereference this
value in sandbox_scmi_devices_remove().
The problem was indicated by 'gcc-11 -fanalyzer'.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
drivers/firmware/scmi/sandbox-scmi_devices.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/firmware/scmi/sandbox-scmi_devices.c b/drivers/firmware/scmi/sandbox-scmi_devices.c
index 414da6f4df..1a6fafbf53 100644
--- a/drivers/firmware/scmi/sandbox-scmi_devices.c
+++ b/drivers/firmware/scmi/sandbox-scmi_devices.c
@@ -50,6 +50,9 @@ static int sandbox_scmi_devices_remove(struct udevice *dev)
int ret = 0;
size_t n;
+ if (!devices)
+ return 0;
+
for (n = 0; n < SCMI_TEST_DEVICES_RD_COUNT; n++) {
int ret2 = reset_free(devices->reset + n);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/1] firmware: smci: possible NULL dereference
2021-02-01 2:01 [PATCH 1/1] firmware: smci: possible NULL dereference Heinrich Schuchardt
@ 2021-02-01 20:44 ` Simon Glass
2021-02-04 1:53 ` Simon Glass
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2021-02-01 20:44 UTC (permalink / raw)
To: u-boot
On Sun, 31 Jan 2021 at 19:02, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> sandbox_scmi_devices_ctx() may return NULL. We should not dereference this
> value in sandbox_scmi_devices_remove().
>
> The problem was indicated by 'gcc-11 -fanalyzer'.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> drivers/firmware/scmi/sandbox-scmi_devices.c | 3 +++
> 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] firmware: smci: possible NULL dereference
2021-02-01 2:01 [PATCH 1/1] firmware: smci: possible NULL dereference Heinrich Schuchardt
2021-02-01 20:44 ` Simon Glass
@ 2021-02-04 1:53 ` Simon Glass
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2021-02-04 1:53 UTC (permalink / raw)
To: u-boot
On Sun, 31 Jan 2021 at 19:02, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> sandbox_scmi_devices_ctx() may return NULL. We should not dereference this
> value in sandbox_scmi_devices_remove().
>
> The problem was indicated by 'gcc-11 -fanalyzer'.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> drivers/firmware/scmi/sandbox-scmi_devices.c | 3 +++
> 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-04 1:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 2:01 [PATCH 1/1] firmware: smci: possible NULL dereference Heinrich Schuchardt
2021-02-01 20:44 ` Simon Glass
2021-02-04 1:53 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.