[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] exec: fix writing to MMIO area with non-power-of-two length



commit 9fab8e1fe15014a4bd147eeedd2491bcfbba4e59
Author:     Paolo Bonzini <pbonzini@xxxxxxxxxx>
AuthorDate: Mon Jul 29 14:27:39 2013 +0200
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Tue Sep 24 22:12:44 2013 -0500

    exec: fix writing to MMIO area with non-power-of-two length
    
    The problem is introduced by commit 2332616 (exec: Support 64-bit
    operations in address_space_rw, 2013-07-08).  Before that commit,
    memory_access_size would only return 1/2/4.
    
    Since alignment is already handled above, reduce l to the largest
    power of two that is smaller than l.
    
    Cc: qemu-stable@xxxxxxxxxx
    Reported-by: Oleksii Shevchuk <alxchk@xxxxxxxxx>
    Tested-by: Oleksii Shevchuk <alxchk@xxxxxxxxx>
    Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    (cherry picked from commit 098178f2749a63fbbb1a626dcc7d939d5cb2bde7)
    
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 exec.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/exec.c b/exec.c
index 3ca9381..394f7e2 100644
--- a/exec.c
+++ b/exec.c
@@ -1928,6 +1928,9 @@ static int memory_access_size(MemoryRegion *mr, unsigned 
l, hwaddr addr)
     if (l > access_size_max) {
         l = access_size_max;
     }
+    if (l & (l - 1)) {
+        l = 1 << (qemu_fls(l) - 1);
+    }
 
     return l;
 }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.