diff options
author | Suraj Jitindar Singh <sjitindarsingh@gmail.com> | 2017-09-13 16:59:46 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-09-15 01:51:55 -0500 |
commit | aefd3ffce6ed8f586290c0044446024f6e6fdcd5 (patch) | |
tree | 03dc220d54312501a0c0bf6f931198f7775da92b /external | |
parent | 4a2b8317fd3fee38fdce9b6d6e1639752335204a (diff) | |
download | blackbird-skiboot-aefd3ffce6ed8f586290c0044446024f6e6fdcd5.tar.gz blackbird-skiboot-aefd3ffce6ed8f586290c0044446024f6e6fdcd5.zip |
pflash: Fix erase command for unaligned start address
The erase_range() function handles erasing the flash for a given start
address and length, and can handle an unaligned start address and
length. However in the unaligned start address case we are incorrectly
calculating the remaining size which can lead to incomplete erases.
If we're going to update the remaining size based on what the start
address was then we probably want to do that before we overide the
origin start address. So rearrange the code so that this is indeed the
case.
Reported-by: Pridhiviraj Paidipeddi <ppaidipe@in.ibm.com>
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/pflash/pflash.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c index bfc975fe..5b1be3ce 100644 --- a/external/pflash/pflash.c +++ b/external/pflash/pflash.c @@ -331,9 +331,9 @@ static int erase_range(struct flash_details *flash, fprintf(stderr, "Failed to blocklevel_smart_erase(): %d\n", rc); return 1; } - start += flash->erase_granule - (start & erase_mask); size -= flash->erase_granule - (start & erase_mask); done = flash->erase_granule - (start & erase_mask); + start += flash->erase_granule - (start & erase_mask); } progress_tick(done); while (size & ~(erase_mask)) { |