Skip to content
Snippets Groups Projects
Commit fd39941a authored by Avi Kivity's avatar Avi Kivity Committed by Blue Swirl
Browse files

Fix off-by-one in dirty bitmap functions


Reported-by: default avatarStefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Signed-off-by: default avatarBlue Swirl <blauwirbel@gmail.com>
parent 9ec032d2
No related branches found
No related tags found
No related merge requests found
......@@ -83,9 +83,10 @@ static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
uint8_t *p;
ram_addr_t addr, end;
end = start + length;
end = TARGET_PAGE_ALIGN(start + length);
start &= TARGET_PAGE_MASK;
p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
for (addr = start; addr <= end; addr += TARGET_PAGE_SIZE) {
for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
*p++ |= dirty_flags;
}
}
......@@ -98,10 +99,11 @@ static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start,
uint8_t *p;
ram_addr_t addr, end;
end = start + length;
end = TARGET_PAGE_ALIGN(start + length);
start &= TARGET_PAGE_MASK;
mask = ~dirty_flags;
p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
for (addr = start; addr <= end; addr += TARGET_PAGE_SIZE) {
for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
*p++ &= mask;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment