The built-in mmap-backed region path already rejects zero-sized mappings, so this doesn't seem to affect the normal GuestMemoryMmap flow.
However, GuestMemoryRegion is a public extension trait intended for custom memory backends, and I couldn't find documentation stating that len() must be non-zero.
A custom implementation returning 0 can be accepted by GuestRegionCollection::from_regions(), but later code assumes non-empty regions:
self.start_addr().unchecked_add(self.len() - 1)
This makes the invariant implicit rather than documented.
The built-in mmap-backed region path already rejects zero-sized mappings, so this doesn't seem to affect the normal
GuestMemoryMmapflow.However,
GuestMemoryRegionis a public extension trait intended for custom memory backends, and I couldn't find documentation stating thatlen()must be non-zero.A custom implementation returning
0can be accepted byGuestRegionCollection::from_regions(), but later code assumes non-empty regions:This makes the invariant implicit rather than documented.