Date: Thu, 2 Sep 2010 22:26:49 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r212165 - head/sys/boot/ofw/libofw Message-ID: <201009022226.o82MQoCs023073@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Thu Sep 2 22:26:49 2010 New Revision: 212165 URL: http://svn.freebsd.org/changeset/base/212165 Log: In the case of non-sequential mappings, ofw_mapmem() could ask Open Firmware to map a memory region with negative length, causing crashes and Undefined Behavior. Add the appropriate check to make the behavior defined. Modified: head/sys/boot/ofw/libofw/ofw_copy.c Modified: head/sys/boot/ofw/libofw/ofw_copy.c ============================================================================== --- head/sys/boot/ofw/libofw/ofw_copy.c Thu Sep 2 21:52:43 2010 (r212164) +++ head/sys/boot/ofw/libofw/ofw_copy.c Thu Sep 2 22:26:49 2010 (r212165) @@ -68,7 +68,7 @@ ofw_mapmem(vm_offset_t dest, const size_ /* * Trim area covered by existing mapping, if any */ - if (dest < (last_dest + last_len)) { + if (dest < (last_dest + last_len) && dest >= last_dest) { nlen -= (last_dest + last_len) - dest; dest = last_dest + last_len; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009022226.o82MQoCs023073>