aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/exec.c b/exec.c
index edafdebeec..d4b769d0d4 100644
--- a/exec.c
+++ b/exec.c
@@ -1843,6 +1843,7 @@ static void *file_ram_alloc(RAMBlock *block,
bool truncate,
Error **errp)
{
+ Error *err = NULL;
MachineState *ms = MACHINE(qdev_get_machine());
void *area;
@@ -1900,8 +1901,9 @@ static void *file_ram_alloc(RAMBlock *block,
}
if (mem_prealloc) {
- os_mem_prealloc(fd, area, memory, ms->smp.cpus, errp);
- if (errp && *errp) {
+ os_mem_prealloc(fd, area, memory, ms->smp.cpus, &err);
+ if (err) {
+ error_propagate(errp, err);
qemu_ram_munmap(fd, area, memory);
return NULL;
}
@@ -3901,10 +3903,9 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length)
if ((start + length) <= rb->used_length) {
bool need_madvise, need_fallocate;
- uint8_t *host_endaddr = host_startaddr + length;
- if ((uintptr_t)host_endaddr & (rb->page_size - 1)) {
- error_report("ram_block_discard_range: Unaligned end address: %p",
- host_endaddr);
+ if (length & (rb->page_size - 1)) {
+ error_report("ram_block_discard_range: Unaligned length: %zx",
+ length);
goto err;
}