summaryrefslogtreecommitdiff
path: root/drivers/firmware
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-02-01 05:01:54 +0300
committerSimon Glass <sjg@chromium.org>2021-02-03 13:38:41 +0300
commit6f5edbaf938952e4a9860727c633dcaa36caf699 (patch)
treedaaf7db3ddddf0ff1504821691459ec254f6ad27 /drivers/firmware
parentc30a7093e81be0dbec963b6b347f678630c2eb8d (diff)
downloadu-boot-6f5edbaf938952e4a9860727c633dcaa36caf699.tar.xz
firmware: smci: possible NULL dereference
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> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/scmi/sandbox-scmi_devices.c3
1 files changed, 3 insertions, 0 deletions
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);