mem/cxl_type3: Fix overlapping region validation error
PATCH v2 1/1 mem/cxl_type3: Fix overlapping region validation error
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)
---
V1[1] -> V2:
- Use ranges_overlap() to improve code readability
- Replace the ASCII extended graph to ASCII basic in comment.
[1] https://lore.kernel.org/qemu-devel/[email protected]
--- hw/mem/cxl_type3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/mem/cxl_type3.c +1 -3
@@ -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 (ranges_overlap (start, length, p->start, p->length)) {error_setg (errp,"Overlap with existing poisoned region not supported" );return ;
Signature · 1 line
2.37.3
Quoted 4 lines · Yao Xingtao via
When injecting a new poisoned region through
qmp_cxl_inject_poison(), the newly injected region should not overlap with existing poisoned regions.
Quoted 9 lines
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)
Quoted 13 lines
Reviewed-by Jonathan Cameron <[email protected]>Suggested-by Peter Maydell <[email protected]>Signed-off-by Yao Xingtao <[email protected]>---
V1[1] -> V2:
- Useranges_overlap()to improve code readability
- Replace the ASCII extended graph to ASCII basic in comment.[1] https://lore.kernel.org/qemu-devel/[email protected]
--- hw/mem/cxl_type3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)