summaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authordrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-08-22 12:08:47 +0000
committerdrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-08-22 12:08:47 +0000
commit2feac34e3fc27b22997d3a3794974192c345eb26 (patch)
tree7164d776762892d5f43886491a0d061cc13c7b55 /src/target
parentdaa58ab2965d17b40384b070c6ec467b9d802828 (diff)
downloadopenocd_libswd-2feac34e3fc27b22997d3a3794974192c345eb26.tar.gz
openocd_libswd-2feac34e3fc27b22997d3a3794974192c345eb26.tar.bz2
openocd_libswd-2feac34e3fc27b22997d3a3794974192c345eb26.tar.xz
openocd_libswd-2feac34e3fc27b22997d3a3794974192c345eb26.zip
- fix a off-by-one error in the buffer read/write code that checks for a address wrap
git-svn-id: svn://svn.berlios.de/openocd/trunk@957 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target')
-rw-r--r--src/target/target.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 9f633ee1..d91928d1 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -870,7 +870,7 @@ int target_write_buffer(struct target_s *target, u32 address, u32 size, u8 *buff
return ERROR_FAIL;
}
- if (address+size<address)
+ if ((address + size - 1) < address)
{
/* GDB can request this when e.g. PC is 0xfffffffc*/
LOG_ERROR("address+size wrapped(0x%08x, 0x%08x)", address, size);
@@ -946,7 +946,7 @@ int target_read_buffer(struct target_s *target, u32 address, u32 size, u8 *buffe
return ERROR_FAIL;
}
- if (address+size<address)
+ if ((address + size - 1) < address)
{
/* GDB can request this when e.g. PC is 0xfffffffc*/
LOG_ERROR("address+size wrapped(0x%08x, 0x%08x)", address, size);