Fix off by one in hpet_mmap() csw method.

Reported by:	C Turt <ecturt@gmail.com>
Reviewed by:	alc, markj
Tested by:	pho
admbug:		781
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
kib 2018-12-02 13:27:36 +00:00
parent 61e5f27315
commit ea0a5b75bc

View File

@ -396,7 +396,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr,
struct hpet_softc *sc;
sc = cdev->si_drv1;
if (offset > rman_get_size(sc->mem_res))
if (offset >= rman_get_size(sc->mem_res))
return (EINVAL);
if (!sc->mmap_allow_write && (nprot & PROT_WRITE))
return (EPERM);