Skip to content

Commit 16fa57d

Browse files
Fix riscv013_invalidate_cached_progbuf() off by one error
See #1139 riscv013_invalidate_cached_progbuf() was failing to zeroize the final buffer array element. Use memset() instead of a manual loop to zeroize it in order to address this and simplify the code.
1 parent 841b61a commit 16fa57d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/target/riscv/riscv-013.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5282,8 +5282,7 @@ static int riscv013_invalidate_cached_progbuf(struct target *target)
52825282
}
52835283

52845284
LOG_TARGET_DEBUG(target, "Invalidating progbuf cache");
5285-
for (unsigned int i = 0; i < 15; i++)
5286-
dm->progbuf_cache[i] = 0;
5285+
memset(dm->progbuf_cache, 0, sizeof(dm->progbuf_cache));
52875286
return ERROR_OK;
52885287
}
52895288

0 commit comments

Comments
 (0)