mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 09:55:55 +00:00
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>
This commit is contained in:
parent
603d5a42d3
commit
619bd31d1f
4
exec.c
4
exec.c
|
@ -3895,7 +3895,7 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length)
|
||||||
|
|
||||||
uint8_t *host_startaddr = rb->host + start;
|
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",
|
error_report("ram_block_discard_range: Unaligned start address: %p",
|
||||||
host_startaddr);
|
host_startaddr);
|
||||||
goto err;
|
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) {
|
if ((start + length) <= rb->used_length) {
|
||||||
bool need_madvise, need_fallocate;
|
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",
|
error_report("ram_block_discard_range: Unaligned length: %zx",
|
||||||
length);
|
length);
|
||||||
goto err;
|
goto err;
|
||||||
|
|
Loading…
Reference in a new issue