virtio-devices: mem: Relax descriptor size check

The virtio spec allows the use of larger descriptors (for future
expansion). Relax the bounds check to only reject descriptors that are
too small.

Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-04-18 11:18:46 +01:00
parent 2a089db269
commit 82d426162d

View File

@@ -293,7 +293,7 @@ impl Request {
if desc.is_write_only() {
return Err(Error::UnexpectedWriteOnlyDescriptor);
}
if desc.len() as usize != size_of::<VirtioMemReq>() {
if (desc.len() as usize) < size_of::<VirtioMemReq>() {
return Err(Error::InvalidRequest);
}
let req: VirtioMemReq = desc_chain