[coreboot] New patch to review for coreboot: e13a5ed selfboot: fix bug in valid_area()

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Mon Nov 7 21:59:40 CET 2011


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/425

-gerrit

commit e13a5edca121b2781a3fa05f7b4b23476d60ee65
Author: Stefan Reinauer <reinauer at chromium.org>
Date:   Mon Nov 7 12:56:12 2011 -0800

    selfboot: fix bug in valid_area()
    
    valid_area will accept a region as valid for the payload if only a part
    of coreboot fits in that region. This means if a payload reaches into a
    neighboring RESERVED region, coreboot would not care and happily
    overwrite that region, as long as the payload also writes to some RAM.
    
    Change-Id: Ie263f83be18009b01a31c71e7285c998747d097f
    Signed-off-by: Stefan Reinauer <reinauer at google.com>
---
 src/boot/selfboot.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/boot/selfboot.c b/src/boot/selfboot.c
index 573dd5e..ab0bf21 100644
--- a/src/boot/selfboot.c
+++ b/src/boot/selfboot.c
@@ -140,10 +140,10 @@ static int valid_area(struct lb_memory *mem, unsigned long buffer,
 		mtype = mem->map[i].type;
 		mstart = unpack_lb64(mem->map[i].start);
 		mend = mstart + unpack_lb64(mem->map[i].size);
-		if ((mtype == LB_MEM_RAM) && (start < mend) && (end > mstart)) {
+		if ((mtype == LB_MEM_RAM) && (start >= mstart) && (end < mend)) {
 			break;
 		}
-		if ((mtype == LB_MEM_TABLE) && (start < mend) && (end > mstart)) {
+		if ((mtype == LB_MEM_TABLE) && (start >= mstart) && (end < mend)) {
 			printk(BIOS_ERR, "Payload is overwriting coreboot tables.\n");
 			break;
 		}




More information about the coreboot mailing list