From 671cedc92f24e1b1578bb00bd3bf8c019c4cdaed Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Thu, 14 May 2009 21:26:28 +0000 Subject: #136: failed to boot under KVM\QEMU > -------------------------------------+-------------------------------------- > Reporter: silicium@… | Owner: somebody > Type: defect | Status: new > Priority: major | Milestone: > Component: coreboot | Version: v2 > Keywords: | Dependencies: > Patchstatus: patch needs review | > -------------------------------------+-------------------------------------- MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Myles Watson git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4285 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/boot/selfboot.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/boot/selfboot.c') diff --git a/src/boot/selfboot.c b/src/boot/selfboot.c index b904e31a21..d87fe50c82 100644 --- a/src/boot/selfboot.c +++ b/src/boot/selfboot.c @@ -411,7 +411,7 @@ static int load_self_segments( 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 @@ static int load_self_segments( /* 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 @@ static int load_self_segments( (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; -- cgit v1.2.3