Skip to contentSkip to conversation

s390x/mmu: Remove duplicate check for MMU_DATA_STORE

PATCH Applied David Hildenbrand 3 participants 4 messages Oct 17, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x/mmu: Remove duplicate check for MMU_DATA_STORE

No need to double-check if we have a write.

Found by Coverity (CID: 1381016).

Fixes 31b59419069e ("target/s390x: Return exception from mmu_translate_real")
Cc Peter Maydell <[email protected]>
---
 target/s390x/mmu_helper.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
target/s390x/mmu_helper.c +1 -3
index 90b81335f9..c9f3f34750 100644
@@ -556,9 +556,7 @@ int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw,
         *flags |= PAGE_WRITE_INV;
         if (is_low_address(raddr) && rw == MMU_DATA_STORE) {
             /* LAP sets bit 56 */
-            *tec = (raddr & TARGET_PAGE_MASK)
-                 | (rw == MMU_DATA_STORE ? FS_WRITE : FS_READ)
-                 | 0x80;
+            *tec = (raddr & TARGET_PAGE_MASK) | FS_WRITE | 0x80;
             return PGM_PROTECTION;
         }
     }
Signature · 1 line
2.21.0
#1 lore raw
Quoted 3 lines · David Hildenbrand

No need to double-check if we have a write.

Found by Coverity (CID: 1381016).

Copy and past error, it's 1406404.

Quoted 24 lines
Fixes 31b59419069e ("target/s390x: Return exception from mmu_translate_real")
Cc Peter Maydell <[email protected]>
---
  target/s390x/mmu_helper.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
target/s390x/mmu_helper.c +1 -3
index 90b81335f9..c9f3f34750 100644
@@ -556,9 +556,7 @@ int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw,
          *flags |= PAGE_WRITE_INV;
          if (is_low_address(raddr) && rw == MMU_DATA_STORE) {
              /* LAP sets bit 56 */
-            *tec = (raddr & TARGET_PAGE_MASK)
-                 | (rw == MMU_DATA_STORE ? FS_WRITE : FS_READ)
-                 | 0x80;
+            *tec = (raddr & TARGET_PAGE_MASK) | FS_WRITE | 0x80;
              return PGM_PROTECTION;
          }
      }
Signature · 3 lines
Thanks,

David / dhildenb
#3 lore raw
In reply to David Hildenbrand
Quoted 16 lines · On Thu, 17 Oct 2019 14:19:22 +0200 David Hildenbrand <[email protected]> wrote:

No need to double-check if we have a write.

Found by Coverity (CID: 1381016).

Fixes 31b59419069e ("target/s390x: Return exception from mmu_translate_real")
Cc Peter Maydell <[email protected]>
---
 target/s390x/mmu_helper.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
target/s390x/mmu_helper.c +0 -0
index 90b81335f9..c9f3f34750 100644

target/s390x/mmu_helper.c int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw, · line 562

Quoted 10 lines
target/s390x/mmu_helper.c +1 -3
@@ -556,9 +556,7 @@ int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw,
         *flags |= PAGE_WRITE_INV;
         if (is_low_address(raddr) && rw == MMU_DATA_STORE) {
             /* LAP sets bit 56 */
-            *tec = (raddr & TARGET_PAGE_MASK)
-                 | (rw == MMU_DATA_STORE ? FS_WRITE : FS_READ)
-                 | 0x80;
+            *tec = (raddr & TARGET_PAGE_MASK) | FS_WRITE | 0x80;
             return PGM_PROTECTION;
         }
     }

Thanks, applied.