From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: util-linux@vger.kernel.org
Subject: [PATCH] Fix incorrect zone count
Date: Wed, 09 May 2012 23:49:04 +0200 [thread overview]
Message-ID: <4FAAE650.3040403@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 484 bytes --]
Hello all. It seems that the zone map, inodes, inode maps and superblock
aren't included in the zone map. At least it's the impression I've got from:
Super3.s_zmap_blocks = UPPER(BLOCKS -
(1+get_nimaps()+inode_blocks()),
BITS_PER_BLOCK+1);
However, in another place the assumption is opposite and this leads to
an attempt to write outside the allocated buffer. Attached patch fixes it.
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: minix.diff --]
[-- Type: text/x-diff; name="minix.diff", Size: 1081 bytes --]
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 051cd5f..fd68fc9 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -421,13 +432,13 @@ static void super_set_nzones(void)
{
switch (fs_version) {
case 3:
- Super3.s_zones = BLOCKS;
+ Super3.s_zones = BLOCKS - Super3.s_zmap_blocks - (1+get_nimaps()+inode_blocks());
break;
case 2:
- Super.s_zones = BLOCKS;
+ Super.s_zones = BLOCKS - Super.s_zmap_blocks - (1+get_nimaps()+inode_blocks());
break;
default: /* v1 */
- Super.s_nzones = BLOCKS;
+ Super.s_nzones = BLOCKS - Super.s_zmap_blocks - (1+get_nimaps()+inode_blocks());
break;
}
}
@@ -497,8 +508,6 @@ static void setup_tables(void) {
}
super_init_maxsize();
- super_set_nzones();
- zones = get_nzones();
/* some magic nrs: 1 inode / 3 blocks */
if ( req_nr_inodes == 0 )
@@ -522,6 +531,9 @@ static void setup_tables(void) {
}
super_set_map_blocks(inodes);
+ super_set_nzones();
+
+ zones = get_nzones();
imaps = get_nimaps();
zmaps = get_nzmaps();
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
reply other threads:[~2012-05-09 21:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FAAE650.3040403@gmail.com \
--to=phcoder@gmail.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.