summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);