summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkfs.minix.c
diff options
context:
space:
mode:
authorNate Clark2017-01-04 18:31:37 +0100
committerNate Clark2017-01-04 20:42:59 +0100
commitb7b26945d1e4491934111d65ac49091daefbdda8 (patch)
treeb58694cc729364f66c3fd2e25fdab3916d500ecc /disk-utils/mkfs.minix.c
parentbuild-sys: test_linux_version is Linux only (diff)
downloadkernel-qcow2-util-linux-b7b26945d1e4491934111d65ac49091daefbdda8.tar.gz
kernel-qcow2-util-linux-b7b26945d1e4491934111d65ac49091daefbdda8.tar.xz
kernel-qcow2-util-linux-b7b26945d1e4491934111d65ac49091daefbdda8.zip
disk-utils/mkfs.minix: Set ninodes after checking max
ninodes in the superblock needs to be set after inodes is checked against MINIX_MAX_INODES otherwise a value larger than MINIX_MAX_INODES can be attempted to be stored in the superblock. Without this change the command "mkfs.minix -2 -i 65530 <dev>" would write a minix superblock with ninodes set to 0. Signed-off-by: Nate Clark <nate@neworld.us>
Diffstat (limited to 'disk-utils/mkfs.minix.c')
-rw-r--r--disk-utils/mkfs.minix.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 613a06997..47a155c55 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -534,9 +534,9 @@ static void setup_tables(const struct fs_control *ctl) {
if (fs_version == 3)
Super3.s_ninodes = inodes;
else {
- Super.s_ninodes = inodes;
if (inodes > MINIX_MAX_INODES)
inodes = MINIX_MAX_INODES;
+ Super.s_ninodes = inodes;
}
super_set_map_blocks(ctl, inodes);
if (MINIX_MAX_INODES < first_zone_data())