Edward O'Callaghan has uploaded this change for review.
flashrom.c: wip check_access write/erase path
Change-Id: I15ec3131211548ab91be6866f48c5201c9865aa3
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M flashrom.c
1 file changed, 15 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/51/63751/1
diff --git a/flashrom.c b/flashrom.c
index 9728c65..c032dc5 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1267,6 +1267,11 @@
info->region_start = entry->start;
info->region_end = entry->end;
+ const chipsize_t region_len = entry->end - entry->start + 1;
+ int ret = check_access(flashctx, entry->start, region_len, 1);
+ if (!ret)
+ continue;
+
size_t j;
int error = 1; /* retry as long as it's 1 */
for (j = 0; j < NUM_ERASEFUNCTIONS; ++j) {
@@ -1370,6 +1375,11 @@
erase_len - starthere, &starthere, flashctx->chip->gran))) {
if (!writecount++)
msg_cdbg("W");
+
+ ret = check_access(flashctx, info->erase_start + starthere, lenhere, 1);
+ if (!ret)
+ continue;
+
/* Needs the partial write function signature. */
if (flashctx->chip->write(flashctx, backup_contents + starthere,
info->erase_start + starthere, lenhere))
@@ -1474,6 +1484,11 @@
erase_len - starthere, &starthere, flashctx->chip->gran))) {
if (!writecount++)
msg_cdbg("W");
+
+ ret = check_access(flashctx, info->erase_start + starthere, lenhere, 1);
+ if (!ret)
+ continue;
+
/* Needs the partial write function signature. */
if (flashctx->chip->write(flashctx, newcontents + starthere,
info->erase_start + starthere, lenhere))
To view, visit change 63751. To unsubscribe, or for help writing mail filters, visit settings.