diff options
| author | Heinrich Schuchardt <[email protected]> | 2022-12-08 02:14:19 +0100 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2022-12-09 11:25:27 +0530 |
| commit | 8b00be692740736e989776b312c87dc9c0b403c8 (patch) | |
| tree | 3c9646a29f7036acbba57886f94126c241b388d8 | |
| parent | ed8b8f5254752b1a7c7b90f61302095eade5b04a (diff) | |
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 <[email protected]>
Reviewed-by: Xiang W <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
| -rw-r--r-- | lib/sbi/sbi_domain.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 3302213c..32055958 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -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; |
