powerpc/kexec: Fix return of uninitialized variable
[ Upstream commit 83b5a407fbb73e6965adfb4bd0a803724bf87f96 ] 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 Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
499021829c
commit
a0961c2731
1 changed files with 7 additions and 2 deletions
|
@ -909,13 +909,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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue