From: Kees Jongenburger Date: Thu, 18 Apr 2013 15:38:46 +0000 (+0200) Subject: mkfs.mfs:add comment about the overflow check. X-Git-Tag: v3.3.0~1019 X-Git-Url: http://zhaoyanbai.com/repos/man.rndc.html?a=commitdiff_plain;h=04ad4fa1a29508db6f581eadd8c4eead51421609;p=minix.git mkfs.mfs:add comment about the overflow check. Change-Id: I1f09c3a62377164296037f6dc9b7874023123311 --- diff --git a/usr.sbin/mkfs.mfs/mkfs.c b/usr.sbin/mkfs.mfs/mkfs.c index a513e8170..88c35eb6a 100644 --- a/usr.sbin/mkfs.mfs/mkfs.c +++ b/usr.sbin/mkfs.mfs/mkfs.c @@ -562,11 +562,14 @@ ino_t inodes; #define BIGGERBLOCKS "Please try a larger block size for an FS of this size.\n" sup->s_imap_blocks = nb = bitmapsize((uint32_t) (1 + inodes), block_size); + /* Checks for an overflow nb is uint32_t while s_imap_blocks is of type + * int16_t */ if(sup->s_imap_blocks != nb) { fprintf(stderr, "mkfs: too many inode bitmap blocks.\n" BIGGERBLOCKS); exit(1); } sup->s_zmap_blocks = nb = bitmapsize((uint32_t) zones, block_size); + /* Idem here check for overflow */ if(nb != sup->s_zmap_blocks) { fprintf(stderr, "mkfs: too many block bitmap blocks.\n" BIGGERBLOCKS); exit(1);