aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2020-10-25 21:04:07 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2020-10-25 21:04:07 +0000
commit2d34afcd04207cf3fa3d5b7f467a890eae75da41 (patch)
tree5025b7883fefb4806d973bac0bb7b94c42b58d55 /sbin/fsck_ffs
parent883649681528398dc227778882830fc9da0ce58c (diff)
downloadsrc-2d34afcd04207cf3fa3d5b7f467a890eae75da41.tar.gz
src-2d34afcd04207cf3fa3d5b7f467a890eae75da41.zip
Use proper type (ino_t) for inode numbers to avoid improper sign extention
in the Pass 5 checks. The manifestation was fsck_ffs exiting with this error: ** Phase 5 - Check Cyl groups fsck_ffs: inoinfo: inumber 18446744071562087424 out of range The error only manifests itself for filesystems bigger than about 100Tb. Reported by: Nikita Grechikhin <ngrechikhin at yandex.ru> MFC after: 2 weeks Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=367045
Diffstat (limited to 'sbin/fsck_ffs')
-rw-r--r--sbin/fsck_ffs/pass5.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c
index 674ca91e22f3..324e725929f6 100644
--- a/sbin/fsck_ffs/pass5.c
+++ b/sbin/fsck_ffs/pass5.c
@@ -63,6 +63,7 @@ pass5(void)
struct fs *fs = &sblock;
ufs2_daddr_t d, dbase, dmax, start;
int rewritecg = 0;
+ ino_t inum;
struct csum *cs;
struct csum_total cstotal;
struct inodesc idesc[3];
@@ -238,9 +239,9 @@ pass5(void)
}
memset(&newcg->cg_frsum[0], 0, sizeof newcg->cg_frsum);
memset(cg_inosused(newcg), 0, (size_t)(mapsize));
- j = fs->fs_ipg * c;
- for (i = 0; i < inostathead[c].il_numalloced; j++, i++) {
- switch (inoinfo(j)->ino_state) {
+ inum = fs->fs_ipg * c;
+ for (i = 0; i < inostathead[c].il_numalloced; inum++, i++) {
+ switch (inoinfo(inum)->ino_state) {
case USTATE:
break;
@@ -260,10 +261,10 @@ pass5(void)
break;
default:
- if (j < (int)UFS_ROOTINO)
+ if (inum < UFS_ROOTINO)
break;
- errx(EEXIT, "BAD STATE %d FOR INODE I=%d",
- inoinfo(j)->ino_state, j);
+ errx(EEXIT, "BAD STATE %d FOR INODE I=%ju",
+ inoinfo(inum)->ino_state, (uintmax_t)inum);
}
}
if (c == 0)