summaryrefslogtreecommitdiffstats
path: root/sbin/newfs
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1994-10-22 02:21:53 +0000
committerdg <dg@FreeBSD.org>1994-10-22 02:21:53 +0000
commit4d06675bdc1e27111fe0fd9ef02912b2aaf41260 (patch)
treeb196a75d99a8f6f1d203e15d7573a1bf7ab493db /sbin/newfs
parente8b2d4b14c49ad8f46cf79513b197ef3b035c72b (diff)
downloadFreeBSD-src-4d06675bdc1e27111fe0fd9ef02912b2aaf41260.zip
FreeBSD-src-4d06675bdc1e27111fe0fd9ef02912b2aaf41260.tar.gz
Restrict fs_maxfilesize to 2^40; this is part of a bug fix from Kirk
McKusick to work around problems in FFS related to the blkno of a 64bit offset not fitting into an int. Submitted by: Marshall Kirk McKusick
Diffstat (limited to 'sbin/newfs')
-rw-r--r--sbin/newfs/mkfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 4ca25a2..062a82d 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -284,6 +284,8 @@ mkfs(pp, fsys, fi, fo)
sizepb *= NINDIR(&sblock);
sblock.fs_maxfilesize += sizepb;
}
+ /* XXX - hack to prevent overflow of a 32bit block number */
+ sblock.fs_maxfilesize = MIN(sblock.fs_maxfilesize, (u_quad_t) 1 << 39);
/*
* Validate specified/determined secpercyl
* and calculate minimum cylinders per group.
OpenPOWER on IntegriCloud