diff options
author | David Hildenbrand <david@redhat.com> | 2023-01-05 13:45:24 +0100 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2023-03-29 10:20:04 +0300 |
commit | eca533b60a44796143133eeb30fe61a8c9d429e9 (patch) | |
tree | 8fc5380bc9b88c4b8845884df6390deaf28d768b /migration | |
parent | ee2ec0ac52a315c8b4e9991b4523abd0c62d24d7 (diff) |
migration/ram: Fix populate_read_range()
Unfortunately, commit f7b9dcfbcf44 broke populate_read_range(): the loop
end condition is very wrong, resulting in that function not populating the
full range. Lets' fix that.
Fixes: f7b9dcfbcf44 ("migration/ram: Factor out populating pages readable in ram_block_populate_pages()")
Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 5f19a4491941fdc5c5b50ce4ade6ffffe0f591b4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/ram.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/migration/ram.c b/migration/ram.c index 8062713c75..f25ebd9620 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1765,13 +1765,15 @@ out: static inline void populate_read_range(RAMBlock *block, ram_addr_t offset, ram_addr_t size) { + const ram_addr_t end = offset + size; + /* * We read one byte of each page; this will preallocate page tables if * required and populate the shared zeropage on MAP_PRIVATE anonymous memory * where no page was populated yet. This might require adaption when * supporting other mappings, like shmem. */ - for (; offset < size; offset += block->page_size) { + for (; offset < end; offset += block->page_size) { char tmp = *((char *)block->host + offset); /* Don't optimize the read out */ |