From dfea25692c4258d3c82f65814e26d6196503d217 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 16 Oct 2009 22:13:14 +0200 Subject: [PATCH] mkfs.minix: fix strict-aliasing bugs Signed-off-by: Karel Zak --- disk-utils/mkfs.minix.c | 7 +++++-- 1 file 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; -- 2.39.5