[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/29] misc: use QEMU_IS_ALIGNED
From: |
Juan Quintela |
Subject: |
[PULL 10/29] misc: use QEMU_IS_ALIGNED |
Date: |
Mon, 20 Jan 2020 11:33:21 +0100 |
From: Marc-André Lureau <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Stefan Berger <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
exec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exec.c b/exec.c
index 0f6b087f57..67e520d18e 100644
--- a/exec.c
+++ b/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;
- 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;
--
2.24.1
- [PULL 00/29] Migration pull patches, Juan Quintela, 2020/01/20
- [PULL 01/29] multifd: Initialize local variable, Juan Quintela, 2020/01/20
- [PULL 02/29] migration-test: Add migration multifd test, Juan Quintela, 2020/01/20
- [PULL 04/29] migration-test: introduce functions to handle string parameters, Juan Quintela, 2020/01/20
- [PULL 03/29] migration: Make sure that we don't call write() in case of error, Juan Quintela, 2020/01/20
- [PULL 05/29] runstate: ignore finishmigrate -> prelaunch transition, Juan Quintela, 2020/01/20
- [PULL 06/29] ram.c: remove unneeded labels, Juan Quintela, 2020/01/20
- [PULL 07/29] migration: Rate limit inside host pages, Juan Quintela, 2020/01/20
- [PULL 08/29] migration: Fix incorrect integer->float conversion caught by clang, Juan Quintela, 2020/01/20
- [PULL 09/29] migration: Fix the re-run check of the migrate-incoming command, Juan Quintela, 2020/01/20
- [PULL 10/29] misc: use QEMU_IS_ALIGNED,
Juan Quintela <=
- [PULL 11/29] migration: add savevm_state_handler_remove(), Juan Quintela, 2020/01/20
- [PULL 12/29] migration: savevm_state_handler_insert: constant-time element insertion, Juan Quintela, 2020/01/20
- [PULL 13/29] migration/ram: Yield periodically to the main loop, Juan Quintela, 2020/01/20
- [PULL 14/29] migration/postcopy: reduce memset when it is zero page and matches_target_page_size, Juan Quintela, 2020/01/20
- [PULL 15/29] migration/postcopy: wait for decompress thread in precopy, Juan Quintela, 2020/01/20
- [PULL 16/29] migration/postcopy: count target page number to decide the place_needed, Juan Quintela, 2020/01/20
- [PULL 17/29] migration/postcopy: set all_zero to true on the first target page, Juan Quintela, 2020/01/20
- [PULL 18/29] migration/postcopy: enable random order target page arrival, Juan Quintela, 2020/01/20
- [PULL 19/29] migration/postcopy: enable compress during postcopy, Juan Quintela, 2020/01/20
- [PULL 20/29] migration/multifd: clean pages after filling packet, Juan Quintela, 2020/01/20