diff mbox

[PULL,5/5] Revert "exec: Respect as_tranlsate_internal length clamp"

Message ID 1427884177-4928-6-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini April 1, 2015, 10:29 a.m. UTC
This reverts commit c3c1bb99d1c11978d9ce94d1bdcf0705378c1459.
It causes problems with boards that declare memory regions shorter
than the registers they contain.

Reported-by: Zoltan Balaton <balaton@eik.bme.hu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 exec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Eric Blake April 1, 2015, 12:27 p.m. UTC | #1
On 04/01/2015 04:29 AM, Paolo Bonzini wrote:
> This reverts commit c3c1bb99d1c11978d9ce94d1bdcf0705378c1459.

Which means the typo in that commit message (tranlsate) is perpetuated
here too.  Cute.  Thankfully doesn't hurt anything other than bothering
OCD editors (does that mean I'm becoming one?  :)
Peter Maydell April 1, 2015, 12:31 p.m. UTC | #2
On 1 April 2015 at 13:27, Eric Blake <eblake@redhat.com> wrote:
> On 04/01/2015 04:29 AM, Paolo Bonzini wrote:
>> This reverts commit c3c1bb99d1c11978d9ce94d1bdcf0705378c1459.
>
> Which means the typo in that commit message (tranlsate) is perpetuated
> here too.  Cute.

Yep, but since we're quoting the earlier commit message
it's correct to include it typo and all. I guess Paolo
could have added a "(sic)" :-)

-- PMM
Paolo Bonzini April 1, 2015, 1:18 p.m. UTC | #3
On 01/04/2015 14:31, Peter Maydell wrote:
>> > On 04/01/2015 04:29 AM, Paolo Bonzini wrote:
>>> >> This reverts commit c3c1bb99d1c11978d9ce94d1bdcf0705378c1459.
>> >
>> > Which means the typo in that commit message (tranlsate) is perpetuated
>> > here too.  Cute.
> Yep, but since we're quoting the earlier commit message
> it's correct to include it typo and all. I guess Paolo
> could have added a "(sic)" :-)

I have fixed the typo in the version I staged for 2.4.  :)

Paolo
diff mbox

Patch

diff --git a/exec.c b/exec.c
index 6d1e1e4..874ecfc 100644
--- a/exec.c
+++ b/exec.c
@@ -380,6 +380,7 @@  MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr,
     IOMMUTLBEntry iotlb;
     MemoryRegionSection *section;
     MemoryRegion *mr;
+    hwaddr len = *plen;
 
     rcu_read_lock();
     for (;;) {
@@ -394,7 +395,7 @@  MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr,
         iotlb = mr->iommu_ops->translate(mr, addr, is_write);
         addr = ((iotlb.translated_addr & ~iotlb.addr_mask)
                 | (addr & iotlb.addr_mask));
-        *plen = MIN(*plen, (addr | iotlb.addr_mask) - addr + 1);
+        len = MIN(len, (addr | iotlb.addr_mask) - addr + 1);
         if (!(iotlb.perm & (1 << is_write))) {
             mr = &io_mem_unassigned;
             break;
@@ -405,9 +406,10 @@  MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr,
 
     if (xen_enabled() && memory_access_is_direct(mr, is_write)) {
         hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr;
-        *plen = MIN(page, *plen);
+        len = MIN(page, len);
     }
 
+    *plen = len;
     *xlat = addr;
     rcu_read_unlock();
     return mr;