[PATCH] kexec ppc64: fix segv when missing root= on cmdline

Michael Neuling mikey at neuling.org
Tue May 30 15:02:08 EST 2006


If the first kernel command line or the --command-line parameter doesn't
have a 'root=', we seg fault on ppc64.

Patch below is against Maneesh's kexec-tools-1.101-kdump8 patches.  

Signed-off-by: Michael Neuling <mikey at neuling.org>

--
 kexec/arch/ppc64/fs2dt.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Index: kexec-tools-1.101/kexec/arch/ppc64/fs2dt.c
===================================================================
--- kexec-tools-1.101.orig/kexec/arch/ppc64/fs2dt.c
+++ kexec-tools-1.101/kexec/arch/ppc64/fs2dt.c
@@ -267,10 +267,12 @@ void putprops(char *fn, struct dirent **
 					char *old_param;
 					memcpy(temp_cmdline, dt, len);
 					param = strstr(temp_cmdline, "root=");
-					old_param = strtok(param, " ");
-					if (cmd_len != 0)
-						strcat(local_cmdline, " ");
-					strcat(local_cmdline, old_param);
+					if (param) {
+						old_param = strtok(param, " ");
+						if (cmd_len != 0)
+							strcat(local_cmdline, " ");
+						strcat(local_cmdline, old_param);
+					}
 				}
 				strcat(local_cmdline, " ");
 				cmd_len = strlen(local_cmdline);







More information about the Linuxppc-dev mailing list