diff --git a/arch/risc-v/src/common/riscv_addrenv_shm.c b/arch/risc-v/src/common/riscv_addrenv_shm.c index 3d81d5ad189..170e88b3eaa 100644 --- a/arch/risc-v/src/common/riscv_addrenv_shm.c +++ b/arch/risc-v/src/common/riscv_addrenv_shm.c @@ -159,6 +159,10 @@ int up_shmdt(uintptr_t vaddr, unsigned int npages) paddr = mmu_pte_to_paddr(mmu_ln_getentry(ptlevel, ptprev, vaddr)); ptlast = riscv_pgvaddr(paddr); + if (!ptlast) + { + return -EFAULT; + } /* Then wipe the reference */