svn commit: r213292 - stable/8/sys/boot/ofw/libofw

Nathan Whitehorn nwhitehorn at FreeBSD.org
Thu Sep 30 04:06:17 UTC 2010


Author: nwhitehorn
Date: Thu Sep 30 04:06:16 2010
New Revision: 213292
URL: http://svn.freebsd.org/changeset/base/213292

Log:
  MFC r212165:
  
  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:
  stable/8/sys/boot/ofw/libofw/ofw_copy.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/boot/ofw/libofw/ofw_copy.c
==============================================================================
--- stable/8/sys/boot/ofw/libofw/ofw_copy.c	Thu Sep 30 04:03:14 2010	(r213291)
+++ stable/8/sys/boot/ofw/libofw/ofw_copy.c	Thu Sep 30 04:06:16 2010	(r213292)
@@ -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;
 	}


More information about the svn-src-all mailing list