cpu/armv7m: Avoid regions with negative size

Don't initialze regions that have a negative size (for example due to a
wrong calculation).

Update #4450
This commit is contained in:
Christian Mauderer
2021-05-28 16:58:49 +02:00
parent 93f9645595
commit 5ad17be930

View File

@@ -656,7 +656,7 @@ static inline void _ARMV7M_MPU_Set_region(
RTEMS_OBFUSCATE_VARIABLE(end); RTEMS_OBFUSCATE_VARIABLE(end);
size = (uintptr_t) end - (uintptr_t) begin; size = (uintptr_t) end - (uintptr_t) begin;
if ( size > 0 ) { if ( (uintptr_t) end > (uintptr_t) begin ) {
rbar = (uintptr_t) begin | region | ARMV7M_MPU_RBAR_VALID; rbar = (uintptr_t) begin | region | ARMV7M_MPU_RBAR_VALID;
rasr |= _ARMV7M_MPU_Get_region_size(size); rasr |= _ARMV7M_MPU_Get_region_size(size);
} else { } else {