Skip to content

Commit 9a5573e

Browse files
mpepaulusmack
authored andcommitted
[PATCH] ppc64: Check of_chosen in check_for_initrd()
You can't call get_property() on a NULL node, so check if of_chosen is set in check_for_initrd(). Signed-off-by: Michael Ellerman <[email protected]> arch/ppc64/kernel/setup.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) Signed-off-by: Paul Mackerras <[email protected]>
1 parent 9592032 commit 9a5573e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

arch/ppc64/kernel/setup.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -536,15 +536,19 @@ static void __init check_for_initrd(void)
536536

537537
DBG(" -> check_for_initrd()\n");
538538

539-
prop = (u64 *)get_property(of_chosen, "linux,initrd-start", NULL);
540-
if (prop != NULL) {
541-
initrd_start = (unsigned long)__va(*prop);
542-
prop = (u64 *)get_property(of_chosen, "linux,initrd-end", NULL);
539+
if (of_chosen) {
540+
prop = (u64 *)get_property(of_chosen,
541+
"linux,initrd-start", NULL);
543542
if (prop != NULL) {
544-
initrd_end = (unsigned long)__va(*prop);
545-
initrd_below_start_ok = 1;
546-
} else
547-
initrd_start = 0;
543+
initrd_start = (unsigned long)__va(*prop);
544+
prop = (u64 *)get_property(of_chosen,
545+
"linux,initrd-end", NULL);
546+
if (prop != NULL) {
547+
initrd_end = (unsigned long)__va(*prop);
548+
initrd_below_start_ok = 1;
549+
} else
550+
initrd_start = 0;
551+
}
548552
}
549553

550554
/* If we were passed an initrd, set the ROOT_DEV properly if the values

0 commit comments

Comments
 (0)