[coreboot] [v2] r4285 - trunk/coreboot-v2/src/boot
svn at coreboot.org
svn at coreboot.org
Thu May 14 23:26:28 CEST 2009
Author: rminnich
Date: 2009-05-14 23:26:28 +0200 (Thu, 14 May 2009)
New Revision: 4285
Modified:
trunk/coreboot-v2/src/boot/selfboot.c
Log:
#136: failed to boot under KVM\QEMU
> -------------------------------------+--------------------------------------
> Reporter: silicium@?\226?\128?\166 | 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 <rminnich at gmail.com>
Acked-by: Myles Watson <mylesgw at gmail.com>
Modified: trunk/coreboot-v2/src/boot/selfboot.c
===================================================================
--- trunk/coreboot-v2/src/boot/selfboot.c 2009-05-14 03:00:15 UTC (rev 4284)
+++ trunk/coreboot-v2/src/boot/selfboot.c 2009-05-14 21:26:28 UTC (rev 4285)
@@ -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;
More information about the coreboot
mailing list