aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libflash/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libflash/file.c b/libflash/file.c
index 2d3f27d..5cea3fc 100644
--- a/libflash/file.c
+++ b/libflash/file.c
@@ -123,7 +123,7 @@ static int file_erase(struct blocklevel_device *bl, uint64_t dst, uint64_t len)
rc = file_write(bl, dst + i, &d, len - i > sizeof(d) ? sizeof(d) : len - i);
if (rc)
return rc;
- i += sizeof(d);
+ i += len - i > sizeof(d) ? sizeof(d) : len - i;
}
return 0;