Skip to content

Commit 29095ac

Browse files
Andrew Boienashif
authored andcommitted
arc: fix off-by-one in _is_in_region()
Similar issue to what was fixed earlier in the MPUv3 code. start + size should be <= r_addr_end. Fixes a problem where the last byte of an MPU region is incorrectly reported as out-of-bounds. Fixes: #15131 Signed-off-by: Andrew Boie <[email protected]>
1 parent 4ea404d commit 29095ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arc/core/mpu/arc_mpu_v2_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static inline bool _is_in_region(u32_t r_index, u32_t start, u32_t size)
118118
r_size_lshift = (r_size_lshift & 0x3) | ((r_size_lshift >> 7) & 0x1C);
119119
r_addr_end = r_addr_start + (1 << (r_size_lshift + 1));
120120

121-
if (start >= r_addr_start && (start + size) < r_addr_end) {
121+
if (start >= r_addr_start && (start + size) <= r_addr_end) {
122122
return 1;
123123
}
124124

0 commit comments

Comments
 (0)