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:
Heinrich Schuchardt
2022-12-08 02:14:19 +01:00
committed by Anup Patel
parent ed8b8f5254
commit 8b00be6927

View File

@@ -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;