On Thu, 18 Jul 2024 at 17:37, Jonathan Cameron via <qemu-devel@nongnu.org> wrote: > > 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.
I think you can probably write this as ranges_overlap(start, len, p->start, p->length) using the utility function in include/qemu/ranges.h, which is a bit more readable than open-coding the overlap test. (There's another couple of open-coded overlap tests in cxl-mailbox-utils.c.) thanks -- PMM