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
This commit is contained in:
John Baldwin 2013-09-12 20:46:32 +00:00
parent 514a6e6167
commit 6a87d217e2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255497

View File

@ -984,12 +984,12 @@ sys_mincore(td, uap)
* 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 @@ sys_mincore(td, uap)
*/
vecindex = OFF_TO_IDX(end - first_addr);
while ((lastvecindex + 1) < vecindex) {
++lastvecindex;
error = subyte(vec + lastvecindex, 0);
if (error) {
error = EFAULT;
goto done2;
}
++lastvecindex;
}
/*