On Thu, May 14, 2009 at 11:48 AM, coreboot <[email protected]> wrote:
> #136: failed to boot under KVM\QEMU
> -------------------------------------+--------------------------------------
>   Reporter:  silic...@...             |          Owner:  somebody
>       Type:  defect                 |         Status:  new
>   Priority:  major                  |      Milestone:
>  Component:  coreboot               |        Version:  v2
>   Keywords:                         |   Dependencies:
> Patchstatus:  patch needs review     |
> -------------------------------------+--------------------------------------
>  I try to boot kvm with coreboot and kernel payload, but boot hangup. Last
>  massage from it is:
>  Loading Segment: addr: 0x0000000000020000 memsz: 0x0000000000001070
>  filesz: 0x0000000000000000
>  Post relocation: addr: 0x0000000000020000 memsz: 0x0000000000001070
>  filesz: 0x0000000000000000
>  Clearing Segment: addr: 0x00000000000090ae memsz: 0x0000000000008f0e
>
>
>  coreboot-2.0.0-r4281-GRUB2 Срд Май 13 22:50:59 MSD 2009 starting...
>  Uncompressing coreboot to RAM.
>  Uncompressing image to RAM.


Thanks very much for your fix. I have slightly redone it, but here it
is. Not tested, can you test to make sure I got it right?

ron
#136: failed to boot under KVM\QEMU
> -------------------------------------+--------------------------------------
>   Reporter:  silic...@…             |          Owner:  somebody
>       Type:  defect                 |         Status:  new
>   Priority:  major                  |      Milestone:
>  Component:  coreboot               |        Version:  v2
>   Keywords:                         |   Dependencies:
> Patchstatus:  patch needs review     |
> -------------------------------------+--------------------------------------

Fix use of uninitialized pointers. To help in future, move 
the declaration to the same scope as the use. 

Signed-off-by: Ronald G. Minnich <[email protected]>

Index: src/boot/selfboot.c
===================================================================
--- src/boot/selfboot.c	(revision 4284)
+++ src/boot/selfboot.c	(working copy)
@@ -411,7 +411,7 @@
 			return 0;
 	}
 	for(ptr = head->next; ptr != head; ptr = ptr->next) {
-		unsigned char *dest, *middle, *end, *src;
+		unsigned char *dest,*src;
 		printk_debug("Loading Segment: addr: 0x%016lx memsz: 0x%016lx filesz: 0x%016lx\n",
 			ptr->s_dstaddr, ptr->s_memsz, ptr->s_filesz);
 		
@@ -428,6 +428,7 @@
 		
 		/* Copy data from the initial buffer */
 		if (ptr->s_filesz) {
+			unsigned char *middle, *end;
 			size_t len;
 			len = ptr->s_filesz;
 			switch(ptr->compression) {
@@ -464,14 +465,15 @@
 				(unsigned long)middle,
 				(unsigned long)end,
 				(unsigned long)src);
-		}
-		/* Zero the extra bytes between middle & end */
-		if (middle < end) {
-			printk_debug("Clearing Segment: addr: 0x%016lx memsz: 0x%016lx\n",
-				(unsigned long)middle, (unsigned long)(end - middle));
+
+			/* Zero the extra bytes between middle & end */
+			if (middle < end) {
+				printk_debug("Clearing Segment: addr: 0x%016lx memsz: 0x%016lx\n",
+					(unsigned long)middle, (unsigned long)(end - middle));
 			
-			/* Zero the extra bytes */
-			memset(middle, 0, end - middle);
+				/* Zero the extra bytes */
+				memset(middle, 0, end - middle);
+			}
 		}
 	}
 	return 1;
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to