qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: check length directly to make sure the range is aligned
@ 2019-07-12  3:27 Wei Yang
  2019-07-19 17:54 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 11+ messages in thread
From: Wei Yang @ 2019-07-12  3:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Wei Yang, rth, dgilbert, quintela

Since the start addr is already checked, to make sure the range is
aligned, checking the length is enough.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 exec.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/exec.c b/exec.c
index 50ea9c5aaa..8fa980baae 100644
--- a/exec.c
+++ b/exec.c
@@ -4067,10 +4067,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: %lx",
+                         length);
             goto err;
         }
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-11-11 23:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12  3:27 [Qemu-devel] [PATCH] migration: check length directly to make sure the range is aligned Wei Yang
2019-07-19 17:54 ` Dr. David Alan Gilbert
2019-07-19 18:03   ` Paolo Bonzini
2019-07-19 18:06     ` Dr. David Alan Gilbert
2019-10-01  7:54       ` Wei Yang
2019-10-28  1:10       ` Wei Yang
2019-10-29  7:04         ` Dr. David Alan Gilbert
2019-10-29  8:21           ` Wei Yang
2019-11-11 23:19             ` Paolo Bonzini
2019-08-19  2:26   ` Wei Yang
2019-09-13 23:58   ` Wei Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).