Melissa Jost has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/49870 )

Change subject: arch-riscv: Fixed a bug in pmp.cc
......................................................................

arch-riscv: Fixed a bug in pmp.cc

This commit fixes an issue that allowed illegal accesses to the
pmpTable to take place.

Change-Id: If517d0d9579260a8dd8a8d2e0c673564a649a728
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49870
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Reviewed-by: Ayaz Akram <yazak...@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/riscv/pmp.cc
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Ayaz Akram: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/arch/riscv/pmp.cc b/src/arch/riscv/pmp.cc
index dea0744..77ef98f 100644
--- a/src/arch/riscv/pmp.cc
+++ b/src/arch/riscv/pmp.cc
@@ -92,8 +92,8 @@
             match_index = i;
         }

-        if ((PMP_OFF != pmpGetAField(pmpTable[match_index].pmpCfg))
-                                            && (match_index > -1)) {
+        if ((match_index > -1)
+            && (PMP_OFF != pmpGetAField(pmpTable[match_index].pmpCfg))) {
             // check the RWX permissions from the pmp entry
             uint8_t allowed_privs = PMP_READ | PMP_WRITE | PMP_EXEC;


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49870
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If517d0d9579260a8dd8a8d2e0c673564a649a728
Gerrit-Change-Number: 49870
Gerrit-PatchSet: 2
Gerrit-Owner: Melissa Jost <melissakj...@gmail.com>
Gerrit-Reviewer: Ayaz Akram <yazak...@ucdavis.edu>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Melissa Jost <mkj...@ucdavis.edu>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Jason Lowe-Power <power...@gmail.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to