From a3189e21e6d4249a258bf547becb28b8d9c23919 Mon Sep 17 00:00:00 2001 From: David Greenman Date: Sat, 22 Oct 1994 02:21:53 +0000 Subject: [PATCH] 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 --- sbin/newfs/mkfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 4ca25a23f495..062a82d66c5b 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.