Date: Mon, 18 Jan 2016 00:07:04 +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: r294238 - head/sys/arm/arm Message-ID: <201601180007.u0I074dX026051@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Mon Jan 18 00:07:04 2016 New Revision: 294238 URL: https://svnweb.freebsd.org/changeset/base/294238 Log: Add extra checks to make sure the size is valid. We may get an integer underflow when we have small blocks of memory at the start and end of the 32-bit address range. While here, only insert mappings pointing at a non-zero amount of memory. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c ============================================================================== --- head/sys/arm/arm/physmem.c Sun Jan 17 23:03:21 2016 (r294237) +++ head/sys/arm/arm/physmem.c Mon Jan 18 00:07:04 2016 (r294238) @@ -292,9 +292,13 @@ arm_physmem_hardware_region(vm_paddr_t p * than leave some folks with an unusable system while we investigate. */ if (pa == 0) { + if (sz <= PAGE_SIZE) + return; pa = PAGE_SIZE; sz -= PAGE_SIZE; } else if (pa + sz == 0) { + if (sz <= 1024 * 1024) + return; sz -= 1024 * 1024; } @@ -306,7 +310,7 @@ arm_physmem_hardware_region(vm_paddr_t p pa = round_page(pa); sz = trunc_page(sz - adj); - if (hwcnt < nitems(hwregions)) + if (sz > 0 && hwcnt < nitems(hwregions)) insert_region(hwregions, hwcnt++, pa, sz, 0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601180007.u0I074dX026051>