Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Sep 2013 20:46:33 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255497 - head/sys/vm
Message-ID:  <201309122046.r8CKkXw4002019@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Sep 12 20:46:32 2013
New Revision: 255497
URL: http://svnweb.freebsd.org/changeset/base/255497

Log:
  Fix an off-by-one error when populating mincore(2) entries for
  skipped entries.  lastvecindex references the last valid byte,
  so the new bytes should come after it.
  
  Approved by:	re (kib)
  MFC after:	1 week

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==============================================================================
--- head/sys/vm/vm_mmap.c	Thu Sep 12 19:52:23 2013	(r255496)
+++ head/sys/vm/vm_mmap.c	Thu Sep 12 20:46:32 2013	(r255497)
@@ -984,12 +984,12 @@ RestartScan:
 			 * the byte vector is zeroed for those skipped entries.
 			 */
 			while ((lastvecindex + 1) < vecindex) {
+				++lastvecindex;
 				error = subyte(vec + lastvecindex, 0);
 				if (error) {
 					error = EFAULT;
 					goto done2;
 				}
-				++lastvecindex;
 			}
 
 			/*
@@ -1025,12 +1025,12 @@ RestartScan:
 	 */
 	vecindex = OFF_TO_IDX(end - first_addr);
 	while ((lastvecindex + 1) < vecindex) {
+		++lastvecindex;
 		error = subyte(vec + lastvecindex, 0);
 		if (error) {
 			error = EFAULT;
 			goto done2;
 		}
-		++lastvecindex;
 	}
 
 	/*



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