diff --git a/lib/propolis/src/hw/virtio/p9fs.rs b/lib/propolis/src/hw/virtio/p9fs.rs index 036bc9384..9662c962a 100644 --- a/lib/propolis/src/hw/virtio/p9fs.rs +++ b/lib/propolis/src/hw/virtio/p9fs.rs @@ -375,7 +375,9 @@ impl HostFSHandler { Ok(_) => {} } - let space_left = msize as usize + let read_count = u32::min(msize, msg.count); + + let space_left = read_count as usize - size_of::() // Rread.size - size_of::() // Rread.typ - size_of::() // Rread.tag