Date: Tue, 2 Feb 2016 17:57:15 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r295157 - head/sys/arm64/arm64 Message-ID: <201602021757.u12HvFVq096170@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Tue Feb 2 17:57:15 2016 New Revision: 295157 URL: https://svnweb.freebsd.org/changeset/base/295157 Log: Ensure we don't overflow the phys_avail array. Some firmware may provide more memory locations than we have space to record. Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Feb 2 17:33:37 2016 (r295156) +++ head/sys/arm64/arm64/pmap.c Tue Feb 2 17:57:15 2016 (r295157) @@ -596,7 +596,8 @@ pmap_bootstrap(vm_offset_t l1pt, vm_padd * up to the physical address KERNBASE points at. */ map_slot = avail_slot = 0; - for (; map_slot < (physmap_idx * 2); map_slot += 2) { + for (; map_slot < (physmap_idx * 2) && + avail_slot < (PHYS_AVAIL_SIZE - 2); map_slot += 2) { if (physmap[map_slot] == physmap[map_slot + 1]) continue; @@ -612,7 +613,7 @@ pmap_bootstrap(vm_offset_t l1pt, vm_padd } /* Add the memory before the kernel */ - if (physmap[avail_slot] < pa) { + if (physmap[avail_slot] < pa && avail_slot < (PHYS_AVAIL_SIZE - 2)) { phys_avail[avail_slot] = physmap[map_slot]; phys_avail[avail_slot + 1] = pa; physmem += (phys_avail[avail_slot + 1] -
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602021757.u12HvFVq096170>