aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-07-28 16:46:21 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-01 13:57:05 +1000
commit151ab54126c57264fd88f41a8667b78021ca83db (patch)
tree13836a5c8bd97794bd881af491e56c32694157f0
parent4e1e9f12b5f2b18fa0aa71c6558fb799de49625e (diff)
downloadskiboot-151ab54126c57264fd88f41a8667b78021ca83db.zip
skiboot-151ab54126c57264fd88f41a8667b78021ca83db.tar.gz
skiboot-151ab54126c57264fd88f41a8667b78021ca83db.tar.bz2
libflash/file: Fix bad subtraction in file erase path
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-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;