diff options
author | Anup Patel <anup.patel@wdc.com> | 2021-05-20 15:47:07 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2021-05-24 15:47:41 +0530 |
commit | b2dbbc0577e326b6dc1babaa53fb46605c996a72 (patch) | |
tree | fb83473c9f3e931fd1224b40178a251ef315c235 | |
parent | fe92347b9f91c147b314065cc3c2c2b196c55b34 (diff) |
lib: Check region base for merging in sbi_domain_root_add_memregion()
We can merge region B onto region A only if base of region A is
aligned to region A order + 1.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Xiang W <wxjstz@126.com>
-rw-r--r-- | lib/sbi/sbi_domain.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 84f30b9..3096af0 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -511,7 +511,8 @@ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg) if (!nreg1->order) continue; - if ((nreg->base + BIT(nreg->order)) == nreg1->base && + if (!(nreg->base & (BIT(nreg->order + 1) - 1)) && + (nreg->base + BIT(nreg->order)) == nreg1->base && nreg->order == nreg1->order && nreg->flags == nreg1->flags) { nreg->order++; |