From 04ad4fa1a29508db6f581eadd8c4eead51421609 Mon Sep 17 00:00:00 2001 From: Kees Jongenburger Date: Thu, 18 Apr 2013 17:38:46 +0200 Subject: [PATCH] mkfs.mfs:add comment about the overflow check. Change-Id: I1f09c3a62377164296037f6dc9b7874023123311 --- usr.sbin/mkfs.mfs/mkfs.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- 2.44.0