[PATCH rtems 1/2] cpu/armv7m: Avoid regions with negative size

Christian Mauderer christian.mauderer at embedded-brains.de
Fri Jun 4 07:47:26 UTC 2021


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

Update #4450
---
 cpukit/score/cpu/arm/include/rtems/score/armv7m.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/score/cpu/arm/include/rtems/score/armv7m.h b/cpukit/score/cpu/arm/include/rtems/score/armv7m.h
index 8f926e826a..a5eaaef418 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/armv7m.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/armv7m.h
@@ -656,7 +656,7 @@ static inline void _ARMV7M_MPU_Set_region(
   RTEMS_OBFUSCATE_VARIABLE(end);
   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;
     rasr |= _ARMV7M_MPU_Get_region_size(size);
   } else {
-- 
2.26.2



More information about the devel mailing list