diff options
author | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-02-19 18:52:46 +0000 |
---|---|---|
committer | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-02-19 18:52:46 +0000 |
commit | bb0d7ab12a6ad135c5487b841fa4d9ea1dbab7d5 (patch) | |
tree | a89294b91bdb95761b69e4981a6ab80eb5629314 /src/flash | |
parent | 4d3b6e4163449a15563299e12cec64759811b658 (diff) | |
download | openocd_libswd-bb0d7ab12a6ad135c5487b841fa4d9ea1dbab7d5.tar.gz openocd_libswd-bb0d7ab12a6ad135c5487b841fa4d9ea1dbab7d5.tar.bz2 openocd_libswd-bb0d7ab12a6ad135c5487b841fa4d9ea1dbab7d5.tar.xz openocd_libswd-bb0d7ab12a6ad135c5487b841fa4d9ea1dbab7d5.zip |
John Woods <johnrw@gmail.com> fix checks for addresses at upper end of the universe
git-svn-id: svn://svn.berlios.de/openocd/trunk@1377 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r-- | src/flash/flash.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/flash/flash.c b/src/flash/flash.c index ce2ce75d..1572e5cd 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -950,7 +950,7 @@ int flash_erase_address_range(target_t *target, u32 addr, u32 length) } /* check whether it fits */ - if (addr + length > c->base + c->size) + if (addr + length - 1 > c->base + c->size - 1) return ERROR_FLASH_DST_BREAKS_ALIGNMENT; addr -= c->base; @@ -1030,7 +1030,7 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase) section_first = section; section_last = section; padding[section] = 0; - while ((run_address + run_size < c->base + c->size) + while ((run_address + run_size - 1 < c->base + c->size - 1) && (section_last + 1 < image->num_sections)) { if (image->sections[section_last + 1].base_address < (run_address + run_size)) @@ -1052,7 +1052,7 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase) } /* fit the run into bank constraints */ - if (run_address + run_size > c->base + c->size) + if (run_address + run_size - 1 > c->base + c->size - 1) { LOG_WARNING("writing %d bytes only - as image section is %d bytes and bank is only %d bytes", \ c->base + c->size - run_address, run_size, c->size); |