浏览代码

fdt_support.c: Correct linux,initrd-start/end setting

The change to add 64bit initrd support broke 32bit initrd support as it
always set 64bits worth of data into the properties, even on 32bit
systems.  The fix is to use addr_cell_len (which already says how much
data is in 'tmp') to set the property, rather than always setting 8.
Thanks to Stephen Warren for pointing out the fix here.

Reported-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Tom Rini <trini@ti.com>
Tom Rini 11 年之前
父节点
当前提交
be6d426697
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      common/fdt_support.c

+ 2 - 2
common/fdt_support.c

@@ -204,7 +204,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 	if ((path == NULL) || force) {
 	if ((path == NULL) || force) {
 		write_cell((u8 *)&tmp, initrd_start, addr_cell_len);
 		write_cell((u8 *)&tmp, initrd_start, addr_cell_len);
 		err = fdt_setprop(fdt, nodeoffset,
 		err = fdt_setprop(fdt, nodeoffset,
-			"linux,initrd-start", &tmp, sizeof(tmp));
+			"linux,initrd-start", &tmp, addr_cell_len);
 		if (err < 0) {
 		if (err < 0) {
 			printf("WARNING: "
 			printf("WARNING: "
 				"could not set linux,initrd-start %s.\n",
 				"could not set linux,initrd-start %s.\n",
@@ -213,7 +213,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		}
 		}
 		write_cell((u8 *)&tmp, initrd_end, addr_cell_len);
 		write_cell((u8 *)&tmp, initrd_end, addr_cell_len);
 		err = fdt_setprop(fdt, nodeoffset,
 		err = fdt_setprop(fdt, nodeoffset,
-			"linux,initrd-end", &tmp, sizeof(tmp));
+			"linux,initrd-end", &tmp, addr_cell_len);
 		if (err < 0) {
 		if (err < 0) {
 			printf("WARNING: could not set linux,initrd-end %s.\n",
 			printf("WARNING: could not set linux,initrd-end %s.\n",
 				fdt_strerror(err));
 				fdt_strerror(err));