mpfs_mpu: Check that size is valid for MPUCFG
The size must be power-of-two for NAPOT according to the the PMP spec. Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
This commit is contained in:
parent
9d4bd915eb
commit
cfa544357e
@ -159,9 +159,11 @@ int mpfs_mpu_set(uintptr_t reg, uintptr_t perm, uintptr_t base,
|
|||||||
return -EACCES;
|
return -EACCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Base must be word aligned, minimum size is 4K */
|
/* Base must be word aligned,
|
||||||
|
* minimum size is 4K and it has to be power-of-two
|
||||||
|
*/
|
||||||
|
|
||||||
if ((base & 0x07) != 0 || size < 0x1000)
|
if ((base & 0x07) != 0 || size < 0x1000 || (size & (size - 1)) != 0)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user