[coreboot] [PATCH] flahsrom: fix off-by-one error in erase

Jody McIntyre scjody at sun.com
Thu Jan 22 22:17:07 CET 2009

There appears to be an off-by-one error when using flashrom's erase:

# flashrom -E
Calibrating delay loop... OK.
No coreboot table found.
Found chipset "Intel 631xESB/632xESB/3100", enabling flash write... OK.
Found chip "SST SST49LF008A" (1024 KB) at physical address 0xfff00000.
Erasing flash chip... FAILED!
ERROR at 0x00100000: Expected=0xff, Read=0x00

Index: flashrom.c
--- flashrom.c	(revision 3882)
+++ flashrom.c	(working copy)
@@ -592,7 +592,7 @@
 			memcpy(buf, (const char *)flash->virtual_memory, size);
 			flash->read(flash, buf);
-		for (erasedbytes = 0; erasedbytes <= size; erasedbytes++)
+		for (erasedbytes = 0; erasedbytes < size; erasedbytes++)
 			if (0xff != buf[erasedbytes]) {
 				fprintf(stderr, "ERROR at 0x%08x: Expected=0xff, Read=0x%02x\n",

More information about the coreboot mailing list