This patch fixes the obvious bugs but filo self-relocation still
fails. I need an ack.

ron
1. fix spelling error. 
2. paranoid setting of info->memrange to 0
3. don't use malloc when it is not possible to use malloc. 
Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>

Index: main/linuxbios.c
===================================================================
--- main/linuxbios.c	(revision 35)
+++ main/linuxbios.c	(working copy)
@@ -89,7 +89,7 @@
 		}
 		if (head->header_bytes != sizeof(*head))
 			continue;
-		debug("Found canidate at: %p\n", head);
+		debug("Found candidate at: %p\n", head);
 		if (ipchksum((uint16_t *)head, sizeof(*head)) != 0) 
 			continue;
 		debug("header checksum o.k.\n");
@@ -114,6 +114,7 @@
 	struct lb_header *lb_table;
 	int found;
 	debug("Searching for LinuxBIOS tables...\n");
+	info->memrange = 0;
 	found = 0;
 	if (!found) {
 		found = find_lb_table(phys_to_virt(0x00000), phys_to_virt(0x01000), &lb_table);
Index: i386/sys_info.c
===================================================================
--- i386/sys_info.c	(revision 35)
+++ i386/sys_info.c	(working copy)
@@ -11,6 +11,8 @@
 {
     int i;
     unsigned long long total = 0;
+    /* this fake memory range covers the case that we can't find any LB structs. */
+    static struct memrange fakememrange[2];
 
     /* Pick up paramters given by bootloader to us */
     info->boot_type = boot_ctx->eax;
@@ -30,7 +32,8 @@
 	printf("Can't get memory map from firmware. "
 		"Using hardcoded default.\n");
 	info->n_memranges = 2;
-	info->memrange = malloc(2 * sizeof(struct memrange));
+	/* NOTE: DO NOT USE MALLOC HERE */
+	info->memrange = fakememrange;
 	info->memrange[0].base = 0;
 	info->memrange[0].size = 640*1024;
 	info->memrange[1].base = 1024*1024;
-- 
linuxbios mailing list
linuxbios@linuxbios.org
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to