summaryrefslogtreecommitdiff
path: root/disk-utils/mkfs.minix.c
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2009-10-16 22:13:14 +0200
committerKarel Zak <kzak@redhat.com>2009-10-17 00:19:23 +0200
commitdfea25692c4258d3c82f65814e26d6196503d217 (patch)
tree272f82a2af37a740039f86569fcb81abf8b859a6 /disk-utils/mkfs.minix.c
parentc326060c2fe3ffbb302e2cbce9e8ae3c4947a652 (diff)
downloadutil-linux-old-dfea25692c4258d3c82f65814e26d6196503d217.tar.gz
mkfs.minix: fix strict-aliasing bugs
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/mkfs.minix.c')
-rw-r--r--disk-utils/mkfs.minix.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 391f09b8..c52afbd7 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -111,7 +111,7 @@ static char * inode_buffer = NULL;
#define Inode (((struct minix_inode *) inode_buffer)-1)
#define Inode2 (((struct minix2_inode *) inode_buffer)-1)
-static char super_block_buffer[BLOCK_SIZE];
+static char *super_block_buffer;
static char boot_block_buffer[512];
#define Super (*(struct minix_super_block *)super_block_buffer)
#define INODES ((unsigned long)Super.s_ninodes)
@@ -394,7 +394,10 @@ setup_tables(void) {
int i;
unsigned long inodes;
- memset(super_block_buffer,0,BLOCK_SIZE);
+ super_block_buffer = calloc(1, BLOCK_SIZE);
+ if (!super_block_buffer)
+ die(_("unable to alloc buffer for superblock"));
+
memset(boot_block_buffer,0,512);
Super.s_magic = magic;
Super.s_log_zone_size = 0;