[PATCH] ppc64: firmware workaround

Anton Blanchard anton at samba.org
Fri Apr 29 23:51:51 EST 2005


Recent gcc 4.0 testing uncovered a firmware issue. Some properties are
larger than 31 bytes and due to gcc 4.0s better stack allocation this
overflow ran over non volatile register storage.

Signed-off-by: Anton Blanchard <anton at samba.org>

Index: linux-2.6.12-rc2/arch/ppc64/kernel/prom_init.c
===================================================================
--- linux-2.6.12-rc2.orig/arch/ppc64/kernel/prom_init.c	2005-04-29 23:45:36.975308922 +1000
+++ linux-2.6.12-rc2/arch/ppc64/kernel/prom_init.c	2005-04-29 23:48:20.497309791 +1000
@@ -1448,6 +1448,12 @@
 	}
 }
 
+/* 
+ * The Open Firmware 1275 specification states properties must be 31 bytes or
+ * less, however not all firmwares obey this. Make it 64 bytes to be safe.
+ */
+#define MAX_PROPERTY_NAME 64
+
 static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
 					unsigned long *mem_end)
 {
@@ -1457,7 +1463,7 @@
 	unsigned long soff;
 	unsigned char *valp;
 	unsigned long offset = reloc_offset();
-	char pname[32];
+	char pname[MAX_PROPERTY_NAME];
 	char *path;
 
 	path = RELOC(prom_scratch);



More information about the Linuxppc64-dev mailing list