diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 3c91526cd..7f05b0cc5 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -1975,7 +1975,7 @@ static int riscv_address_translate(struct target *target, if (!(pte & PTE_V) || (!(pte & PTE_R) && (pte & PTE_W))) return ERROR_FAIL; - if ((pte & PTE_R) || (pte & PTE_X)) /* Found leaf PTE. */ + if ((pte & PTE_R) || (pte & PTE_W) || (pte & PTE_X)) /* Found leaf PTE. */ break; i--;