Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Sep 2010 04:06:16 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r213292 - stable/8/sys/boot/ofw/libofw
Message-ID:  <201009300406.o8U46GKM052067@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009300406.o8U46GKM052067>