diff options
author | Cyril Bur <cyril.bur@au1.ibm.com> | 2018-02-27 16:31:39 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2018-02-28 21:02:39 -0600 |
commit | fe8945fb5edb98a1a2ad8f0ce91ef49b9edbbdac (patch) | |
tree | aae4d91bd115e8d86707c1121f59617835551e94 | |
parent | 49c175d9a026648f5f902db018f1986365a72610 (diff) | |
download | skiboot-fe8945fb5edb98a1a2ad8f0ce91ef49b9edbbdac.zip skiboot-fe8945fb5edb98a1a2ad8f0ce91ef49b9edbbdac.tar.gz skiboot-fe8945fb5edb98a1a2ad8f0ce91ef49b9edbbdac.tar.bz2 |
libflash/blocklevel: Correct miscalculation in blocklevel_smart_erase()
If blocklevel_smart_erase() detects that the smart erase fits entire in
one erase block, it has an early bail path. In this path it miscaculates
where in the buffer the backend needs to read from to perform the final
write.
Fixes: d6a5b53f ("libflash/blocklevel: Add blocklevel_smart_erase()")
Fixes: https://github.com/open-power/skiboot/issues/151
Reported-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
Tested-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
(cherry picked from commit 682e196627a062731dc2596276013f2e9fa9f6db)
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | libflash/blocklevel.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libflash/blocklevel.c b/libflash/blocklevel.c index eaab431..809d33c 100644 --- a/libflash/blocklevel.c +++ b/libflash/blocklevel.c @@ -348,7 +348,7 @@ int blocklevel_smart_erase(struct blocklevel_device *bl, uint64_t pos, uint64_t * so we need to write back the chunk at the end of the block */ if (base_pos + base_len + len < base_pos + block_size) { - rc = bl->write(bl, pos + len, erase_buf + pos + len, + rc = bl->write(bl, pos + len, erase_buf + base_len + len, block_size - base_len - len); FL_DBG("%s: Early exit, everything was in one erase block\n", __func__); |