From e37b3f410cd4d3c22787c6c3edd5ae1118835a35 Mon Sep 17 00:00:00 2001 From: simonb Date: Sat, 21 Jan 2006 12:32:14 +0000 Subject: [PATCH] Use 64-bit arithmetic to calculate fragsperinodeblk, avoiding 32-bit overflows for large values of "-i bytes-per-inode". --- sbin/newfs/mkfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 2a106e248e45..93a57a095e29 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.99 2006/01/16 21:34:41 dsl Exp $ */ +/* $NetBSD: mkfs.c,v 1.100 2006/01/21 12:32:14 simonb Exp $ */ /* * Copyright (c) 1980, 1989, 1993 @@ -73,7 +73,7 @@ #if 0 static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: mkfs.c,v 1.99 2006/01/16 21:34:41 dsl Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.100 2006/01/21 12:32:14 simonb Exp $"); #endif #endif /* not lint */ @@ -364,7 +364,7 @@ mkfs(struct partition *pp, const char *fsys, int fi, int fo, * 1 fragment per inode - useful for /dev. */ fragsperinodeblk = MAX(numfrags(&sblock, - density * INOPB(&sblock)), 1); + (uint64_t)density * INOPB(&sblock)), 1); inodeblks = (sblock.fs_size - sblock.fs_iblkno) / (sblock.fs_frag + fragsperinodeblk); }