Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Apr 2017 10:16:35 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r317250 - stable/10/sbin/fsck_ffs
Message-ID:  <201704211016.v3LAGZMx026433@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Apr 21 10:16:34 2017
New Revision: 317250
URL: https://svnweb.freebsd.org/changeset/base/317250

Log:
  MFC r316852:
  In fsck_ffs pass1, prevent the inosused variable from wrapping.
  
  PR:	218592

Modified:
  stable/10/sbin/fsck_ffs/pass1.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/fsck_ffs/pass1.c
==============================================================================
--- stable/10/sbin/fsck_ffs/pass1.c	Fri Apr 21 10:13:07 2017	(r317249)
+++ stable/10/sbin/fsck_ffs/pass1.c	Fri Apr 21 10:16:34 2017	(r317250)
@@ -133,9 +133,14 @@ pass1(void)
 		 */
 		if ((preen || inoopt) && usedsoftdep && !rebuildcg) {
 			cp = &cg_inosused(cgp)[(inosused - 1) / CHAR_BIT];
-			for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) {
-				if (*cp == 0)
+			for ( ; inosused != 0; cp--) {
+				if (*cp == 0) {
+					if (inosused > CHAR_BIT)
+						inosused -= CHAR_BIT;
+					else
+						inosused = 0;
 					continue;
+				}
 				for (i = 1 << (CHAR_BIT - 1); i > 0; i >>= 1) {
 					if (*cp & i)
 						break;
@@ -143,8 +148,6 @@ pass1(void)
 				}
 				break;
 			}
-			if (inosused < 0)
-				inosused = 0;
 		}
 		/*
 		 * Allocate inoinfo structures for the allocated inodes.



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