summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Goodbody <andrew.goodbody@linaro.org>2025-07-18 13:19:54 +0100
committerTom Rini <trini@konsulko.com>2025-07-29 13:12:12 -0600
commitae409a84e7bffb0c5a0d420d72806ac7b854f619 (patch)
treef9b12fe5fd4adf3e806327ce652d6eeaf8f81c9b
parent808d4bc2bdcedb9ffca57b85984e53d39e1cb718 (diff)
spl: NULL check variable before dereference
In boot_from_devices the variable loader is not NULL checked after assignment and before first use but later code does check it for NULL. Add a NULL check before first use. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
-rw-r--r--common/spl/spl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index d8e26605d20..ed443c645a7 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -634,7 +634,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
if (CONFIG_IS_ENABLED(SHOW_ERRORS))
ret = -ENXIO;
for (loader = drv; loader != drv + n_ents; loader++) {
- if (bootdev != loader->boot_device)
+ if (loader && bootdev != loader->boot_device)
continue;
if (!CONFIG_IS_ENABLED(SILENT_CONSOLE)) {
if (loader)