Skip to content

Commit 83b5a40

Browse files
Zhang Zekunmpe
authored andcommitted
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: 2e6bd22 ("powerpc/kexec_file: Enable early kernel OPAL calls") Signed-off-by: Zhang Zekun <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 352268d commit 83b5a40

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arch/powerpc/kexec/file_load_64.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,13 +736,18 @@ int setup_purgatory_ppc64(struct kimage *image, const void *slave_code,
736736
if (dn) {
737737
u64 val;
738738

739-
of_property_read_u64(dn, "opal-base-address", &val);
739+
ret = of_property_read_u64(dn, "opal-base-address", &val);
740+
if (ret)
741+
goto out;
742+
740743
ret = kexec_purgatory_get_set_symbol(image, "opal_base", &val,
741744
sizeof(val), false);
742745
if (ret)
743746
goto out;
744747

745-
of_property_read_u64(dn, "opal-entry-address", &val);
748+
ret = of_property_read_u64(dn, "opal-entry-address", &val);
749+
if (ret)
750+
goto out;
746751
ret = kexec_purgatory_get_set_symbol(image, "opal_entry", &val,
747752
sizeof(val), false);
748753
}

0 commit comments

Comments
 (0)