diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index 0ac6dd9fcdcd..963f43fb52c5 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -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.