Blame SOURCES/kvm-softmmu-physmem-Simplify-flatview_write-and-address_.patch

4841a6
From 916423392b46167c6683b0240610bb5a745590da Mon Sep 17 00:00:00 2001
6443c2
From: Jon Maloy <jmaloy@redhat.com>
6443c2
Date: Wed, 13 Apr 2022 14:51:06 -0400
4841a6
Subject: [PATCH 2/3] softmmu/physmem: Simplify flatview_write and
6443c2
 address_space_access_valid
6443c2
MIME-Version: 1.0
6443c2
Content-Type: text/plain; charset=UTF-8
6443c2
Content-Transfer-Encoding: 8bit
6443c2
6443c2
RH-Author: Jon Maloy <jmaloy@redhat.com>
4841a6
RH-MergeRequest: 151: hw/intc/arm_gicv3: Check for !MEMTX_OK instead of MEMTX_ERROR
4841a6
RH-Commit: [2/3] daabe41eefd5c519def592e374fa368e32a680d3 (jmaloy/qemu-kvm)
4841a6
RH-Bugzilla: 1999236
6443c2
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
6443c2
RH-Acked-by: Peter Xu <peterx@redhat.com>
6443c2
4841a6
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1999236
6443c2
Upstream: Merged
6443c2
CVE: CVE-2021-3750
6443c2
6443c2
commit 58e74682baf4e1ad26b064d8c02e5bc99c75c5d9
6443c2
Author: Philippe Mathieu-Daudé <philmd@redhat.com>
6443c2
Date:   Wed Dec 15 19:24:20 2021 +0100
6443c2
6443c2
    softmmu/physmem: Simplify flatview_write and address_space_access_valid
6443c2
6443c2
    Remove unuseful local 'result' variables.
6443c2
6443c2
    Reviewed-by: Peter Xu <peterx@redhat.com>
6443c2
    Reviewed-by: David Hildenbrand <david@redhat.com>
6443c2
    Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
6443c2
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
6443c2
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6443c2
    Message-Id: <20211215182421.418374-3-philmd@redhat.com>
6443c2
    Signed-off-by: Thomas Huth <thuth@redhat.com>
6443c2
6443c2
(cherry picked from commit 58e74682baf4e1ad26b064d8c02e5bc99c75c5d9)
6443c2
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
6443c2
---
6443c2
 softmmu/physmem.c | 11 +++--------
6443c2
 1 file changed, 3 insertions(+), 8 deletions(-)
6443c2
6443c2
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
6443c2
index 3524c04c2a..483a31be81 100644
6443c2
--- a/softmmu/physmem.c
6443c2
+++ b/softmmu/physmem.c
6443c2
@@ -2815,14 +2815,11 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
6443c2
     hwaddr l;
6443c2
     hwaddr addr1;
6443c2
     MemoryRegion *mr;
6443c2
-    MemTxResult result = MEMTX_OK;
6443c2
 
6443c2
     l = len;
6443c2
     mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
6443c2
-    result = flatview_write_continue(fv, addr, attrs, buf, len,
6443c2
-                                     addr1, l, mr);
6443c2
-
6443c2
-    return result;
6443c2
+    return flatview_write_continue(fv, addr, attrs, buf, len,
6443c2
+                                   addr1, l, mr);
6443c2
 }
6443c2
 
6443c2
 /* Called within RCU critical section.  */
6443c2
@@ -3119,12 +3116,10 @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr,
6443c2
                                 MemTxAttrs attrs)
6443c2
 {
6443c2
     FlatView *fv;
6443c2
-    bool result;
6443c2
 
6443c2
     RCU_READ_LOCK_GUARD();
6443c2
     fv = address_space_to_flatview(as);
6443c2
-    result = flatview_access_valid(fv, addr, len, is_write, attrs);
6443c2
-    return result;
6443c2
+    return flatview_access_valid(fv, addr, len, is_write, attrs);
6443c2
 }
6443c2
 
6443c2
 static hwaddr
6443c2
-- 
6443c2
2.27.0
6443c2