diff --git a/src/target/target.c b/src/target/target.c index 7571e4e35..3bb2fa360 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -985,6 +985,10 @@ int target_write_buffer(struct target_s *target, u32 address, u32 size, u8 *buff return ERROR_FAIL; } + if (size == 0) { + return ERROR_OK; + } + if ((address + size - 1) < address) { /* GDB can request this when e.g. PC is 0xfffffffc*/ @@ -1060,6 +1064,10 @@ int target_read_buffer(struct target_s *target, u32 address, u32 size, u8 *buffe return ERROR_FAIL; } + if (size == 0) { + return ERROR_OK; + } + if ((address + size - 1) < address) { /* GDB can request this when e.g. PC is 0xfffffffc*/