Message ID | 20250220095654.121634-4-sughosh.ganu@linaro.org |
---|---|
State | New |
Headers | show |
Series | lmb: miscellaneous fixes and improvements | expand |
On 20.02.25 10:56, Sughosh Ganu wrote: > The lmb_add_region_flags() first checks if the new region to be added > can be coalesced with existing regions. The check stops if the two > regions are adjecent but their flags do not match. However, it is > possible that the newly added region might be adjacent with the next > existing region and with matching flags. Check for this possibility by > not breaking out of the loop. > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> > --- > Changes since V1: > * Continue the loop only in the case where the newly added region is > after the existing region. > > lib/lmb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/lmb.c b/lib/lmb.c > index 207f059ceb9..45888989457 100644 > --- a/lib/lmb.c > +++ b/lib/lmb.c > @@ -194,7 +194,7 @@ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base, > break; > } else if (ret < 0) { > if (flags != rgnflags) > - break; > + continue; > rgn[i].size += size; > coalesced++; > break; Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
diff --git a/lib/lmb.c b/lib/lmb.c index 207f059ceb9..45888989457 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -194,7 +194,7 @@ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base, break; } else if (ret < 0) { if (flags != rgnflags) - break; + continue; rgn[i].size += size; coalesced++; break;
The lmb_add_region_flags() first checks if the new region to be added can be coalesced with existing regions. The check stops if the two regions are adjecent but their flags do not match. However, it is possible that the newly added region might be adjacent with the next existing region and with matching flags. Check for this possibility by not breaking out of the loop. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> --- Changes since V1: * Continue the loop only in the case where the newly added region is after the existing region. lib/lmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)