mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-05-31 20:05:59 +08:00
fix(libcpu): correct arm mpu region validation precedence
This commit is contained in:
@@ -108,12 +108,12 @@ rt_bool_t rt_hw_mpu_region_valid(rt_mem_region_t *region)
|
|||||||
LOG_E("Region size is too small");
|
LOG_E("Region size is too small");
|
||||||
return RT_FALSE;
|
return RT_FALSE;
|
||||||
}
|
}
|
||||||
if (region->size & (~(MPU_MIN_REGION_SIZE - 1U)) != region->size)
|
if ((region->size & (~(MPU_MIN_REGION_SIZE - 1U))) != region->size)
|
||||||
{
|
{
|
||||||
LOG_E("Region size is not a multiple of 32 bytes");
|
LOG_E("Region size is not a multiple of 32 bytes");
|
||||||
return RT_FALSE;
|
return RT_FALSE;
|
||||||
}
|
}
|
||||||
if ((rt_uint32_t)region->start & (MPU_MIN_REGION_SIZE - 1U) != 0U)
|
if (((rt_uint32_t)region->start & (MPU_MIN_REGION_SIZE - 1U)) != 0U)
|
||||||
{
|
{
|
||||||
LOG_E("Region is not aligned by 32 bytes");
|
LOG_E("Region is not aligned by 32 bytes");
|
||||||
return RT_FALSE;
|
return RT_FALSE;
|
||||||
|
|||||||
@@ -71,12 +71,12 @@ rt_bool_t rt_hw_mpu_region_valid(rt_mem_region_t *region)
|
|||||||
LOG_E("Region size is too small");
|
LOG_E("Region size is too small");
|
||||||
return RT_FALSE;
|
return RT_FALSE;
|
||||||
}
|
}
|
||||||
if (region->size & (region->size - 1U) != 0U)
|
if ((region->size & (region->size - 1U)) != 0U)
|
||||||
{
|
{
|
||||||
LOG_E("Region size is not power of 2");
|
LOG_E("Region size is not power of 2");
|
||||||
return RT_FALSE;
|
return RT_FALSE;
|
||||||
}
|
}
|
||||||
if ((rt_uint32_t)region->start & (region->size - 1U) != 0U)
|
if (((rt_uint32_t)region->start & (region->size - 1U)) != 0U)
|
||||||
{
|
{
|
||||||
LOG_E("Region is not naturally aligned");
|
LOG_E("Region is not naturally aligned");
|
||||||
return RT_FALSE;
|
return RT_FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user