From: Karel Zak Date: Fri, 16 Oct 2009 20:13:14 +0000 (+0200) Subject: mkfs.minix: fix strict-aliasing bugs X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfea25692c4258d3c82f65814e26d6196503d217;p=util-linux mkfs.minix: fix strict-aliasing bugs Signed-off-by: Karel Zak --- 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;