File ppc64-diag.bug-931001_read_values_from_dev_tree.patch of Package ppc64-diag.636
When add phandles for memory in the ibm,dynamic-memory property, the first
From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
32 bits of the property are the number of LMBs in the property. This
needs to be read as a BE value, failure to do this results in allocating
way more phandle structs that necccessary and reading past the end of the
end of the buffer holding the property.
Add proper conversion for LE systems.
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
rtas_errd/prrn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: ppc64-diag-2.6.7/rtas_errd/prrn.c
===================================================================
--- ppc64-diag-2.6.7.orig/rtas_errd/prrn.c
+++ ppc64-diag-2.6.7/rtas_errd/prrn.c
@@ -227,7 +227,7 @@ static int add_drconf_phandles()
fread(membuf, sbuf.st_size, 1, fd);
fclose(fd);
- entries = membuf[0];
+ entries = be32toh(membuf[0]);
mem = (struct drconf_cell *)&membuf[1];
for (i = 0; i < entries; i++) {