summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ifs
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2001-03-31 15:19:58 +0000
committeradrian <adrian@FreeBSD.org>2001-03-31 15:19:58 +0000
commit1d52622861ade01fba488110e63ed8ba868cfcdf (patch)
tree94a7d2d92d425831f0e78018eb656e0bea7daa76 /sbin/fsck_ifs
parent8b4d22a1bbe92cf8b73395b1464db7c8d8055840 (diff)
downloadFreeBSD-src-1d52622861ade01fba488110e63ed8ba868cfcdf.zip
FreeBSD-src-1d52622861ade01fba488110e63ed8ba868cfcdf.tar.gz
Quoting from the email thrown around between kirk, bde and iedowse@..
<QUOTE> Overflow of cg_niblk causes spurious "SUMMARY INFORMATION BAD" warnings prompts in fsck_ffs. cg_niblk has type int16_t, but it is (ab)used to hold the number of inodes per group (it has nothing to do with the number of inode blocks in the cg as claimed in ffs/fs.h), and there can be lots of inodes per group. E.g., newfs -i 8192 -b 16384 -f 16384 -c 255 ... gives 0xA900 inodes/group. Assignment of this to cg_niblk gives -0x5700. This is mostly harmless (ufs/ffs doesn't use cg_niblk, and bug-for-bug compatible overflow occurs in newfs), but in fsck_ffs/pass5.c, negative values of cg_niblk limit cg_irotor to 0 and the summary info appears to be bad. </QUOTE> Submitted by: Bruce Evans <bde@zeta.org.au> Obtained from: Kirk McKusick <mckusick@mckusick.com>
Diffstat (limited to 'sbin/fsck_ifs')
-rw-r--r--sbin/fsck_ifs/pass5.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sbin/fsck_ifs/pass5.c b/sbin/fsck_ifs/pass5.c
index e395625..a9f4487 100644
--- a/sbin/fsck_ifs/pass5.c
+++ b/sbin/fsck_ifs/pass5.c
@@ -68,6 +68,10 @@ pass5()
inoinfo(WINO)->ino_state = USTATE;
memset(newcg, 0, (size_t)fs->fs_cgsize);
+ /*
+ * Note: cg_niblk is 16 bits and may overflow, so it must never
+ * be used except for comparing with the old value.
+ */
newcg->cg_niblk = fs->fs_ipg;
if (cvtlevel >= 3) {
if (fs->fs_maxcontig < 2 && fs->fs_contigsumsize > 0) {
@@ -197,7 +201,7 @@ pass5()
newcg->cg_frotor = cg->cg_frotor;
else
newcg->cg_frotor = 0;
- if (cg->cg_irotor < newcg->cg_niblk)
+ if (cg->cg_irotor < fs->fs_ipg)
newcg->cg_irotor = cg->cg_irotor;
else
newcg->cg_irotor = 0;
OpenPOWER on IntegriCloud