From 2b6d1a639bb9decbef6deecd5e7620c46559c2b4 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 12 Mar 2017 13:53:13 +0000 Subject: [PATCH] Follow-up to r313690. Fix two missed places where vm_object offset to index calculation should use unsigned shift, to allow handling of full range of unsigned offsets used to create device mappings. Reported and tested by: royger (previous version) Reviewed by: alc (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/vm/vm_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 2ea935ee7fb4..197348cca8b9 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -4122,7 +4122,7 @@ RetryLookup:; * Return the object/offset from this entry. If the entry was * copy-on-write or empty, it has been fixed up. */ - *pindex = OFF_TO_IDX((vaddr - entry->start) + entry->offset); + *pindex = UOFF_TO_IDX((vaddr - entry->start) + entry->offset); *object = entry->object.vm_object; *out_prot = prot; @@ -4203,7 +4203,7 @@ vm_map_lookup_locked(vm_map_t *var_map, /* IN/OUT */ * Return the object/offset from this entry. If the entry was * copy-on-write or empty, it has been fixed up. */ - *pindex = OFF_TO_IDX((vaddr - entry->start) + entry->offset); + *pindex = UOFF_TO_IDX((vaddr - entry->start) + entry->offset); *object = entry->object.vm_object; *out_prot = prot;