[PATCH 1/1] firmware: smci: possible NULL dereference
Heinrich Schuchardt
xypron.glpk at gmx.de
Mon Feb 1 03:01:54 CET 2021
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 at 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
More information about the U-Boot
mailing list