aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric van Gyzen <vangyzen@FreeBSD.org>2020-09-18 20:53:40 +0000
committerEric van Gyzen <vangyzen@FreeBSD.org>2020-09-18 20:53:40 +0000
commitd8d2dda141c198a2e9863584e2e61566cc6b222d (patch)
treee52e88320e937c7c4917547dfd2d3497654d1929
parent7afab8a67ee7f4114887bc3b024cc58f8c6dedf1 (diff)
downloadsrc-d8d2dda141c198a2e9863584e2e61566cc6b222d.tar.gz
src-d8d2dda141c198a2e9863584e2e61566cc6b222d.zip
amd64 pmap_pkru_same: prev_ppr was always NULL
Fix the logic so it works as it appears. Reported by: Coverity Reviewed by: kib MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: D26211 (in progress, so omitting full URL)
Notes
Notes: svn path=/head/; revision=365890
-rw-r--r--sys/amd64/amd64/pmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index bfeee119f2ee..d04d2457a1da 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -10788,9 +10788,11 @@ pmap_pkru_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
sva >= VM_MAXUSER_ADDRESS)
return (true);
MPASS(eva <= VM_MAXUSER_ADDRESS);
- for (va = sva, prev_ppr = NULL; va < eva;) {
+ for (va = sva; va < eva; prev_ppr = ppr) {
ppr = rangeset_lookup(&pmap->pm_pkru, va);
- if ((ppr == NULL) ^ (prev_ppr == NULL))
+ if (va == sva)
+ prev_ppr = ppr;
+ else if ((ppr == NULL) ^ (prev_ppr == NULL))
return (false);
if (ppr == NULL) {
va += PAGE_SIZE;