"fuzzy" on irc has tested the 6.1 patch set.
the attached patch fixes the address checking.

-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner
>From 133a4cf958b02c570071f3523d37b1eefaad6331 Mon Sep 17 00:00:00 2001
From: Stefan Tauner <[email protected]>
Date: Wed, 6 Jul 2011 05:29:41 +0200
Subject: [PATCH] fixup! ichspi.c: add support for Intel Hardware Sequencing

- off-by-one error when checking the requested address range

Signed-off-by: Stefan Tauner <[email protected]>
---
 ichspi.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ichspi.c b/ichspi.c
index e7c911b..22e15f4 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1268,7 +1268,7 @@ int ich_hwseq_block_erase(struct flashchip *flash,
 		return -1;
 	}
 
-	if (addr + len >= flash->total_size * 1024) {
+	if (addr + len > flash->total_size * 1024) {
 		msg_perr("Request to erase some inaccessible memory address(es)"
 			 " (addr=0x%x, len=%d). "
 			 "Not erasing anything.\n", addr, len);
@@ -1306,7 +1306,7 @@ int ich_hwseq_read(struct flashchip *flash, uint8_t *buf, int addr, int len)
 		return -1;
 	}
 
-	if (addr < 0 || addr + len >= flash->total_size * 1024) {
+	if (addr < 0 || addr + len > flash->total_size * 1024) {
 		msg_perr("Request to read from an inaccessible memory address "
 			 "(addr=0x%x, len=%d).\n", addr, len);
 		return -1;
@@ -1350,7 +1350,7 @@ int ich_hwseq_write_256(struct flashchip *flash, uint8_t *buf, int addr, int len
 		return -1;
 	}
 
-	if (addr < 0 || addr + len >= flash->total_size * 1024) {
+	if (addr < 0 || addr + len > flash->total_size * 1024) {
 		msg_perr("Request to write to an inaccessible memory address "
 			 "(addr=0x%x, len=%d).\n", addr, len);
 		return -1;
-- 
1.7.1

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to