From 05e1cca97a180df482a89e3bb382cf695cac31da Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 25 Sep 2018 20:07:58 +0000 Subject: [PATCH] Fix some uses of dmaplimit. dmaplimit is the first byte after the end of DMAP. Reported by: "Johnson, Archna" Reviewed by: alc, markj Approved by: re (gjb) MFC after: 1 week Differential revision: https://reviews.freebsd.org/D17318 --- sys/amd64/amd64/pmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d91906a1050..61dfd2607b4 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1422,7 +1422,7 @@ pmap_init(void) if (ppim->va == 0) continue; /* Make the direct map consistent */ - if (ppim->pa < dmaplimit && ppim->pa + ppim->sz < dmaplimit) { + if (ppim->pa < dmaplimit && ppim->pa + ppim->sz <= dmaplimit) { (void)pmap_change_attr(PHYS_TO_DMAP(ppim->pa), ppim->sz, ppim->mode); } @@ -7055,7 +7055,7 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, int mode) * If the specified range of physical addresses fits within * the direct map window, use the direct map. */ - if (pa < dmaplimit && pa + size < dmaplimit) { + if (pa < dmaplimit && pa + size <= dmaplimit) { va = PHYS_TO_DMAP(pa); if (!pmap_change_attr(va, size, mode)) return ((void *)(va + offset));