Hi Michal, >> +int mpumap_contains_region(pr_t *table, uint8_t nr_regions, paddr_t base, >> + paddr_t limit, uint8_t *index) >> +{ >> + ASSERT(index); >> + *index = INVALID_REGION_IDX; >> + >> + /* >> + * The caller supplies a half-open interval [base, limit), i.e. limit >> is the >> + * first byte *after* the region. Require limit strictly greater than >> base, >> + * which is necessarily a non-empty region. >> + */ >> + ASSERT(base < limit); > Well, that does not guarantee a non-empty region. > Consider passing [x, x+1). The assert will pass, even though the region is > empty. > > ~Michal >
Apologies, I may well be missing something here! Please could you suggest a code snippet to understand your expectation here / what you would prefer the assert to be? As I understand it, with a half-open interval [base, limit) as is passed to this function, the size is `limit - base` and so the region [x, x+1) will have size 1. The empty region starting at the same address would be [x, x). But perhaps I am making the off-by-one error here. Many thanks, Hari