The lmb_fix_over_lap_regions() function is called if the added region overlaps with an existing region. The function then fixes the overlap and removes the redundant region. However, it makes an assumption that the overlap would not encompass the existing region, and in such a scenario, it prints a message and returns without making the fix. Handle the case of an encompassing overlap also in the function.
Signed-off-by: Sughosh Ganu <[email protected]> Reported-by: Quentin Schulz <[email protected]> --- Note: To be applied after an A-b/R-b/T-b from the original author of the lmb_fix_over_lap_regions() function on this lib/lmb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/lmb.c b/lib/lmb.c index aeaf120f57d..a5216bdccc7 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -111,11 +111,9 @@ static void lmb_fix_over_lap_regions(struct alist *lmb_rgn_lst, phys_addr_t base2 = rgn[r2].base; phys_size_t size2 = rgn[r2].size; - if (base1 + size1 > base2 + size2) { - printf("This will not be a case any time\n"); - return; - } - rgn[r1].size = base2 + size2 - base1; + if (base1 + size1 < base2 + size2) + rgn[r1].size = base2 + size2 - base1; + lmb_remove_region(lmb_rgn_lst, r2); } -- 2.34.1

