Commit c1ce464d authored by Geoff Levand's avatar Geoff Levand Committed by Paul Mackerras
Browse files

[POWERPC] Minor fix for bootargs property

Avoid the use of an uninitialized stack variable when the powerpc device tree
bootargs property is either missing or incorrectly defined.  This also makes
CONFIG_CMDLINE work properly under these conditions.  This change adds a test
for the existence of the bootargs property.

early_init_dt_scan_chosen() tests for a zero length bootargs property in its
CONFIG_CMDLINE processing, but the current implementation of
of_get_flat_dt_prop() doesn't assign a value to the length when no property is
found.  Since an automatic variable is used, a stale value from the stack will
be used in the test.
Signed-off-by: default avatarGeoff Levand <>
Signed-off-by: default avatarPaul Mackerras <>
parent 52aed7cd
......@@ -724,7 +724,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
if (l == 0 || (l == 1 && (*p) == 0))
if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
#endif /* CONFIG_CMDLINE */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment