diff options
author | Marc-André Lureau | 2020-01-03 08:39:58 +0100 |
---|---|---|
committer | Juan Quintela | 2020-01-20 09:10:22 +0100 |
commit | 619bd31d1f7cc5878e75e989a78d6f1c79356d4a (patch) | |
tree | 7d22da8795aa41f1f45747aafd45a412ac7cddef | |
parent | migration: Fix the re-run check of the migrate-incoming command (diff) | |
download | qemu-619bd31d1f7cc5878e75e989a78d6f1c79356d4a.tar.gz qemu-619bd31d1f7cc5878e75e989a78d6f1c79356d4a.tar.xz qemu-619bd31d1f7cc5878e75e989a78d6f1c79356d4a.zip |
misc: use QEMU_IS_ALIGNED
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
-rw-r--r-- | exec.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3895,7 +3895,7 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length) uint8_t *host_startaddr = rb->host + start; - if ((uintptr_t)host_startaddr & (rb->page_size - 1)) { + if (!QEMU_PTR_IS_ALIGNED(host_startaddr, rb->page_size)) { error_report("ram_block_discard_range: Unaligned start address: %p", host_startaddr); goto err; @@ -3903,7 +3903,7 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length) if ((start + length) <= rb->used_length) { bool need_madvise, need_fallocate; - if (length & (rb->page_size - 1)) { + if (!QEMU_IS_ALIGNED(length, rb->page_size)) { error_report("ram_block_discard_range: Unaligned length: %zx", length); goto err; |