Skip to content

Commit e4a6de3

Browse files
roypatJonathanWoollett-Light
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 d5741e9 commit e4a6de3

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
@@ -5,6 +5,9 @@
55
### Added
66
### Changed
77
### Fixed
8+
- [[#279](https://github.com/rust-vmm/vm-memory/pull/279)] Remove restriction from `read_volatile_from` and `write_volatile_into`
9+
that made it copy data it chunks of 4096.
10+
811
### Removed
912
### Deprecated
1013

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)