[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 73/87] migration: check length directly to make sure the range is
From: |
Paolo Bonzini |
Subject: |
[PULL 73/87] migration: check length directly to make sure the range is aligned |
Date: |
Wed, 18 Dec 2019 13:02:39 +0100 |
From: Wei Yang <address@hidden>
Since the start addr is already checked, to make sure the range is
aligned, checking the length is enough.
Signed-off-by: Wei Yang <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/exec.c b/exec.c
index a34c348..dfe2096 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;
}
--
1.8.3.1
- [PULL 61/87] memory: use RCU_READ_LOCK_GUARD, (continued)
- [PULL 61/87] memory: use RCU_READ_LOCK_GUARD, Paolo Bonzini, 2019/12/18
- [PULL 62/87] colo: fix return without releasing RCU, Paolo Bonzini, 2019/12/18
- [PULL 63/87] build: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NG, Paolo Bonzini, 2019/12/18
- [PULL 65/87] docs: tweak kernel-doc for QEMU coding standards, Paolo Bonzini, 2019/12/18
- [PULL 66/87] docs/conf.py: Enable use of kerneldoc sphinx extension, Paolo Bonzini, 2019/12/18
- [PULL 67/87] Makefile: disable Sphinx nitpicking, Paolo Bonzini, 2019/12/18
- [PULL 71/87] docs: add memory API reference, Paolo Bonzini, 2019/12/18
- [PULL 69/87] docs: Create bitops.rst as example of kernel-docs, Paolo Bonzini, 2019/12/18
- [PULL 68/87] bitops.h: Silence kernel-doc complaints, Paolo Bonzini, 2019/12/18
- [PULL 70/87] memory.h: Silence kernel-doc complaints, Paolo Bonzini, 2019/12/18
- [PULL 73/87] migration: check length directly to make sure the range is aligned,
Paolo Bonzini <=
- [PULL 72/87] memory: include MemoryListener documentation and some missing function parameters, Paolo Bonzini, 2019/12/18
- [PULL 74/87] WHPX: refactor load library, Paolo Bonzini, 2019/12/18
- [PULL 75/87] target/i386: remove unused pci-assign codes, Paolo Bonzini, 2019/12/18
- [PULL 76/87] Fix some comment spelling errors., Paolo Bonzini, 2019/12/18
- [PULL 77/87] hw/pci-host/i440fx: Correct the header description, Paolo Bonzini, 2019/12/18
- [PULL 78/87] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h", Paolo Bonzini, 2019/12/18
- [PULL 79/87] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE(), Paolo Bonzini, 2019/12/18
- [PULL 64/87] docs: import Linux kernel-doc script and extension, Paolo Bonzini, 2019/12/18
- [PULL 80/87] hw/pci-host/i440fx: Use definitions instead of magic values, Paolo Bonzini, 2019/12/18
- [PULL 82/87] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge, Paolo Bonzini, 2019/12/18