> -----Original Message----- > From: Peter Maydell <peter.mayd...@linaro.org> > Sent: Friday, July 19, 2024 1:12 AM > To: Jonathan Cameron <jonathan.came...@huawei.com> > Cc: Yao, Xingtao/姚 幸涛 <yaoxt.f...@fujitsu.com>; fan...@samsung.com; > qemu-devel@nongnu.org > Subject: Re: [PATCH] mem/cxl_type3: Fix overlapping region validation error > > 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. Great! I will fix it in the next revision.
> > (There's another couple of open-coded overlap tests in > cxl-mailbox-utils.c.) I will collect these issues and fix them in separate patches. > > thanks > -- PMM