mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
lib: fix is_region_valid()
For 'reg->order == __riscv_xlen' the term 'BIT(reg->order)' is undefined. Addresses-Coverity-ID: 1529706 ("Bad bit shift operation") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
ed8b8f5254
commit
8b00be6927
@@ -149,7 +149,7 @@ static bool is_region_valid(const struct sbi_domain_memregion *reg)
|
||||
if (reg->order == __riscv_xlen && reg->base != 0)
|
||||
return FALSE;
|
||||
|
||||
if (reg->base & (BIT(reg->order) - 1))
|
||||
if (reg->order < __riscv_xlen && (reg->base & (BIT(reg->order) - 1)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
Reference in New Issue
Block a user