On Thu, 18 Jul 2024 05:07:53 -0400 Yao Xingtao <yaoxt.f...@fujitsu.com> wrote:
> When injecting a new poisoned region through qmp_cxl_inject_poison(), > the newly injected region should not overlap with existing poisoned > regions. > > The current validation method does not consider the following > overlapping region: > ┌───┬───────┬───┐ > │a │ b(a) │a │ > └───┴───────┴───┘ > (a is a newly added region, b is an existing region, and b is a > subregion of a) > > Signed-off-by: Yao Xingtao <yaoxt.f...@fujitsu.com> Looks correct to me. Reviewed-by: Jonathan Cameron <jonathan.came...@huwei.com> I've queued it on my local branch. I need to put together an updated public one. No huge rush to queue this up though I think as the effects are minor. Jonathan > --- > hw/mem/cxl_type3.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c > index 35ac59883a5b..8e32de327908 100644 > --- a/hw/mem/cxl_type3.c > +++ b/hw/mem/cxl_type3.c > @@ -1331,9 +1331,7 @@ void qmp_cxl_inject_poison(const char *path, uint64_t > start, uint64_t length, > ct3d = CXL_TYPE3(obj); > > QLIST_FOREACH(p, &ct3d->poison_list, node) { > - if (((start >= p->start) && (start < p->start + p->length)) || > - ((start + length > p->start) && > - (start + length <= p->start + p->length))) { > + if ((start < p->start + p->length) && (start + length > p->start)) { > error_setg(errp, > "Overlap with existing poisoned region not > supported"); > return;