summaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2012-12-04 11:38:38 +1100
committerAnthony Liguori <aliguori@us.ibm.com>2012-12-12 15:03:31 -0600
commit7ec81e56edc2b2007ce0ae3982aa5c18af9546ab (patch)
treecf7086a39e1e4632ac34cbf6d6724f90f8c8adc9 /arch_init.c
parent1c97e303d4ea80a2691334b0febe87a50660f99d (diff)
downloadqemu-7ec81e56edc2b2007ce0ae3982aa5c18af9546ab.tar.gz
Fix off-by-1 error in RAM migration code
The code for migrating (or savevm-ing) memory pages starts off by creating a dirty bitmap and filling it with 1s. Except, actually, because bit addresses are 0-based it fills every bit except bit 0 with 1s and puts an extra 1 beyond the end of the bitmap, potentially corrupting unrelated memory. Oops. This patch fixes it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch_init.c b/arch_init.c
index e6effe809a..b75a4c5580 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -568,7 +568,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
int64_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS;
migration_bitmap = bitmap_new(ram_pages);
- bitmap_set(migration_bitmap, 1, ram_pages);
+ bitmap_set(migration_bitmap, 0, ram_pages);
migration_dirty_pages = ram_pages;
bytes_transferred = 0;