diff --git a/exec.c b/exec.c index a34c34818404a4bea5ad618d0b666425d1b6abb2..dfe2096d4a767e11f81332236601b783c5f63951 100644 --- a/exec.c +++ b/exec.c @@ -3901,10 +3901,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; }