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 <bbruce@ucdavis.edu>
Reviewed-by: Ayaz Akram <yazakram@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Melissa Jost
2021-09-02 12:25:25 -07:00
committed by Melissa Jost
parent 526f5271d8
commit 737cdd7397

View File

@@ -92,8 +92,8 @@ PMP::pmpCheck(const RequestPtr &req, BaseMMU::Mode mode,
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;