To avoid overrunning the internal buffer we need to take the offset into
the buffer into account.
Fixes: d95da91fb497 ("x86/HVM: grow MMIO cache data size to 64 bytes")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
master commit:
e5339bb689dfa79a914c6c96e1d82d61e1ae3161
master date: 2025-01-23 11:14:48 +0100
}
/* Accesses must not overflow the cache's buffer. */
- if ( size > sizeof(cache->buffer) )
+ if ( offset + size > sizeof(cache->buffer) )
{
ASSERT_UNREACHABLE();
return X86EMUL_UNHANDLEABLE;