On 04/09/2024 2:30 pm, Jan Beulich wrote: > @@ -1094,13 +1094,13 @@ static int hvmemul_linear_mmio_access( > if ( cache == NULL ) > return X86EMUL_UNHANDLEABLE; > > - chunk = min_t(unsigned int, size, PAGE_SIZE - offset); > + ASSERT(size <= PAGE_SIZE - offset);
Do we really want a plain assert, or should we go with if ( size > PAGE_SIZE - offset ) { /* Callers should have arranged not to cross a page boundary */ ASSERT_UNREACHABLE(); return X86EMUL_UNHANDLEABLE; } This is hardly a fastpath, and it's rather safer. ~Andrew