@@ -3715,16 +3715,18 @@ int ram_load_postcopy(QEMUFile *f, int channel)
switch (flags & ~RAM_SAVE_FLAG_CONTINUE) {
case RAM_SAVE_FLAG_ZERO:
ch = qemu_get_byte(f);
+ if (ch != 0) {
+ error_report("Found a zero page with value %d", ch);
+ ret = -EINVAL;
+ break;
+ }
/*
* Can skip to set page_buffer when
* this is a zero page and (block->page_size == TARGET_PAGE_SIZE).
*/
- if (ch || !matches_target_page_size) {
+ if (!matches_target_page_size) {
memset(page_buffer, ch, TARGET_PAGE_SIZE);
}
- if (ch) {
- tmp_page->all_zero = false;
- }
break;
case RAM_SAVE_FLAG_PAGE:
@@ -4030,6 +4032,11 @@ static int ram_load_precopy(QEMUFile *f)
case RAM_SAVE_FLAG_ZERO:
ch = qemu_get_byte(f);
+ if (ch != 0) {
+ error_report("Found a zero page with value %d", ch);
+ ret = -EINVAL;
+ break;
+ }
ram_handle_compressed(host, ch, TARGET_PAGE_SIZE);
break;
@@ -3592,7 +3592,11 @@ int rdma_registration_handle(QEMUFile *f)
host_addr = block->local_host_addr +
(comp->offset - block->offset);
-
+ if (comp->value) {
+ error_report("rdma: Zero page with non-zero (%d) value",
+ comp->value);
+ goto err;
+ }
ram_handle_compressed(host_addr, comp->value, comp->length);
break;