From fa2d2ccb945b4c70ea324c14459dae5a31287bc4 Mon Sep 17 00:00:00 2001 From: Anastasia Klimchuk Date: Sat, 9 Aug 2025 18:37:50 +1000 Subject: [PATCH] Check verify flag in prepare_flash_access before erase operation The last argument in `prepare_flash_access` function indicates whether verify operation was requested. This information is in the flag `verify_after_write` in flash context, so lets pass it to the function. Previously, the last argument which is called `verify_it` was always `false`. This hasn't been detected because in the current implementation of `prepare_flash_access`, `verify_it` is always checked together with `erase_it`, the latter was passed always true. `verify_it` being false is wrong because we have a flag to decide about verification. Also this false value contradicts reality, because erase operation ignores the flag and always verifies (this has always been the case even with earlier implementations of erase logic). Additional context is in the next commit and ticket https://ticket.coreboot.org/issues/520 Change-Id: Idd7526084e4942b7adbbab57a62f7de84b4a4bb5 Signed-off-by: Anastasia Klimchuk Reviewed-on: https://review.coreboot.org/c/flashrom/+/88733 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Stefan Reinauer --- flashrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flashrom.c b/flashrom.c index ac93ea67d..b64a2a057 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1890,7 +1890,7 @@ void finalize_flash_access(struct flashctx *const flash) int flashrom_flash_erase(struct flashctx *const flashctx) { - if (prepare_flash_access(flashctx, false, false, true, false)) + if (prepare_flash_access(flashctx, false, false, true, flashctx->flags.verify_after_write)) return 1; const int ret = erase_by_layout(flashctx);