summaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorZhang Zekun <zhangzekun11@huawei.com>2024-09-30 15:56:28 +0800
committerMichael Ellerman <mpe@ellerman.id.au>2024-11-15 00:29:46 +1100
commit83b5a407fbb73e6965adfb4bd0a803724bf87f96 (patch)
tree43a665e4ae2212686bcc99541c81eed824da708f /arch/powerpc
parent352268dc6da7b422022541c2cf846663110f775c (diff)
downloadlinux-stable-83b5a407fbb73e6965adfb4bd0a803724bf87f96.tar.gz
linux-stable-83b5a407fbb73e6965adfb4bd0a803724bf87f96.tar.bz2
linux-stable-83b5a407fbb73e6965adfb4bd0a803724bf87f96.zip
powerpc/kexec: Fix return of uninitialized variable
of_property_read_u64() can fail and leave the variable uninitialized, which will then be used. Return error if reading the property failed. Fixes: 2e6bd221d96f ("powerpc/kexec_file: Enable early kernel OPAL calls") Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://patch.msgid.link/20240930075628.125138-1-zhangzekun11@huawei.com
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kexec/file_load_64.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
index 9738adabeb1f..dc65c1391157 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -736,13 +736,18 @@ int setup_purgatory_ppc64(struct kimage *image, const void *slave_code,
if (dn) {
u64 val;
- of_property_read_u64(dn, "opal-base-address", &val);
+ ret = of_property_read_u64(dn, "opal-base-address", &val);
+ if (ret)
+ goto out;
+
ret = kexec_purgatory_get_set_symbol(image, "opal_base", &val,
sizeof(val), false);
if (ret)
goto out;
- of_property_read_u64(dn, "opal-entry-address", &val);
+ ret = of_property_read_u64(dn, "opal-entry-address", &val);
+ if (ret)
+ goto out;
ret = kexec_purgatory_get_set_symbol(image, "opal_entry", &val,
sizeof(val), false);
}