[Bugfix, ASAN] test_mem plugin fix OOB read in read_test()

asan correctly identified an out of bound read in the test_mem plugin
This shouldn't cause any issue in normal use since the data isn't used

Change-Id: I52acabc4649397f9dd2ba7979f9210529ced2071
This commit is contained in:
William Wilgus 2024-12-25 12:37:23 -05:00 committed by William Wilgus
parent 1643e0e287
commit 962e1b2e69

View file

@ -132,10 +132,10 @@ static void read_test(volatile int *buf, int buf_size, int loop_cnt)
: "r0", "r1", "r2", "r3", "r4", "r5", "r6", "memory", "cc" : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "memory", "cc"
); );
#else #else
int x; int x, i, j;
for(int i = 0; i < loop_cnt; i++) for(i = 0; i < loop_cnt; i++)
{ {
for(int j = 0; j < buf_size; j+=4) for(j = 0; j < buf_size - 4; j+=4)
{ {
x = buf[j ]; x = buf[j ];
x = buf[j+2]; x = buf[j+2];