Skip to content

Commit 2739a71

Browse files
roypatandreeaflorescu
authored andcommitted
fix: Remove 4096B chunk restriction of read/write_volatile
Fixes a bug where GuestMemory::read_volatile_from and GuestMemory::write_volatile_into would only copy data in chunks of at most 4096 bytes from/into the underlying stream. The check removed in this commit was errorneously copied from the read_from/write_into functions, which use a temporary buffer to transfer data (and this temporary buffer was capped to 4096 bytes). Signed-off-by: Patrick Roy <[email protected]>
1 parent 4892407 commit 2739a71

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
### Changed
77
- [[#275](https://github.com/rust-vmm/vm-memory/pull/275)] Fail builds on non 64-bit platforms.
88
### Fixed
9+
- [[#279](https://github.com/rust-vmm/vm-memory/pull/279)] Remove restriction from `read_volatile_from` and `write_volatile_into`
10+
that made it copy data it chunks of 4096.
11+
912
### Removed
1013
### Deprecated
1114

src/guest_memory.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,6 @@ pub trait GuestMemory {
724724
// Check if something bad happened before doing unsafe things.
725725
assert!(offset <= count);
726726

727-
let len = std::cmp::min(len, MAX_ACCESS_CHUNK);
728-
729727
let mut vslice = region.get_slice(caddr, len)?;
730728

731729
src.read_volatile(&mut vslice)
@@ -749,7 +747,6 @@ pub trait GuestMemory {
749747
// Check if something bad happened before doing unsafe things.
750748
assert!(offset <= count);
751749

752-
let len = std::cmp::min(len, MAX_ACCESS_CHUNK);
753750
let vslice = region.get_slice(caddr, len)?;
754751

755752
// For a non-RAM region, reading could have side effects, so we

0 commit comments

Comments
 (0)