Skip to content

Commit 2b786d9

Browse files
committed
storage: flash: validate what was just writen
1 parent d3e635c commit 2b786d9

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

firmware/controllers/storage_flash.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ StorageStatus SettingStorageFlash::store(size_t id, const uint8_t *ptr, size_t s
116116
}
117117
}
118118

119+
if (status == StorageStatus::Ok) {
120+
if (intFlashCompare(addr, reinterpret_cast<const char*>(ptr), size) != TRUE) {
121+
efiPrintf("Flash: validation failed at 0x%08x", addr);
122+
status = StorageStatus::Failed;
123+
}
124+
}
125+
119126
efitick_t endNt = getTimeNowNt();
120127
int elapsed_Ms = US2MS(NT2US(endNt - startNt));
121128

0 commit comments

Comments
 (0)