]> git.proxmox.com Git - mirror_qemu.git/blobdiff - exec.c
virtio: do not take address of packed members
[mirror_qemu.git] / exec.c
diff --git a/exec.c b/exec.c
index 610d0c07467398e183c7d39395f7ff7f0b2a5642..4f5df07b6a26a8aea869c6baac820a0097c79d51 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1046,6 +1046,10 @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs)
     MemoryRegion *mr;
     hwaddr l = 1;
 
+    if (!tcg_enabled()) {
+        return;
+    }
+
     rcu_read_lock();
     mr = address_space_translate(as, addr, &addr, &l, false, attrs);
     if (!(memory_region_is_ram(mr)
@@ -1841,6 +1845,10 @@ static void *file_ram_alloc(RAMBlock *block,
                    " must be multiples of page size 0x%zx",
                    block->mr->align, block->page_size);
         return NULL;
+    } else if (block->mr->align && !is_power_of_2(block->mr->align)) {
+        error_setg(errp, "alignment 0x%" PRIx64
+                   " must be a power of two", block->mr->align);
+        return NULL;
     }
     block->mr->align = MAX(block->page_size, block->mr->align);
 #if defined(__s390x__)