mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-03-15 19:31:32 +00:00
lib: utils/fdt/fdt_domain: Simplify region access permission check
The region access permission check in __fdt_parse_region() can be simplified as masking SBI_DOMAIN_MEMREGION_{M,SU}_ACCESS_MASK is enough. While we are here, update the confusing comments to match the codes. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
parent
5a75f5309c
commit
bc06ff65bf
1 changed files with 4 additions and 6 deletions
|
@ -244,13 +244,11 @@ static int __fdt_parse_region(void *fdt, int domain_offset,
|
|||
* access permissions. M-mode regions can only be part of
|
||||
* root domain.
|
||||
*
|
||||
* SU permission bits can't be all zeroes and M-mode permission
|
||||
* bits must be all set.
|
||||
* SU permission bits can't be all zeroes when M-mode permission
|
||||
* bits have at least one bit set.
|
||||
*/
|
||||
if (!((region_access & SBI_DOMAIN_MEMREGION_SU_ACCESS_MASK)
|
||||
& SBI_DOMAIN_MEMREGION_SU_RWX)
|
||||
&& ((region_access & SBI_DOMAIN_MEMREGION_M_ACCESS_MASK)
|
||||
& SBI_DOMAIN_MEMREGION_M_RWX))
|
||||
if (!(region_access & SBI_DOMAIN_MEMREGION_SU_ACCESS_MASK)
|
||||
&& (region_access & SBI_DOMAIN_MEMREGION_M_ACCESS_MASK))
|
||||
return SBI_EINVAL;
|
||||
|
||||
/* Find next region of the domain */
|
||||
|
|
Loading…
Add table
Reference in a new issue