aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2006-10-05 14:35:16 -0400
committerPaul Mackerras <paulus@samba.org>2006-10-06 07:10:41 -0400
commitc1ce464d29e5bbf5819b2d7527b7d3030a6d65f1 (patch)
treebce7ed6d765c3cd7a75c4cbcccb25b62ed242966
parent52aed7cd52ce8a1d576e26976c3950512e1af8b6 (diff)
[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: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/prom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index eb913f80bfb1..865b9648d0d5 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -724,7 +724,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
724 strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); 724 strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
725 725
726#ifdef CONFIG_CMDLINE 726#ifdef CONFIG_CMDLINE
727 if (l == 0 || (l == 1 && (*p) == 0)) 727 if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
728 strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); 728 strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
729#endif /* CONFIG_CMDLINE */ 729#endif /* CONFIG_CMDLINE */
730 730