summaryrefslogtreecommitdiff
path: root/libparted/fs
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2020-11-10 14:39:06 -0800
committerBrian C. Lane <bcl@redhat.com>2020-11-20 14:00:58 -0800
commit1e086dba260630b63e0822731522ce04c081d95e (patch)
tree4c490fdf5458aaee6c9d2c0cb6dc9c3c043067e6 /libparted/fs
parent006ad756c70603212309157fa05c5d855e25f07e (diff)
downloadparted-1e086dba260630b63e0822731522ce04c081d95e.tar.gz
ext2: Fix gcc 10 warnings about cast alignment
Diffstat (limited to 'libparted/fs')
-rw-r--r--libparted/fs/ext2/ext2_fs.h2
-rw-r--r--libparted/fs/ext2/interface.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/libparted/fs/ext2/ext2_fs.h b/libparted/fs/ext2/ext2_fs.h
index ac1b6a0..362f8bc 100644
--- a/libparted/fs/ext2/ext2_fs.h
+++ b/libparted/fs/ext2/ext2_fs.h
@@ -173,7 +173,7 @@ struct ext2_inode
#define i_size_high i_dir_acl
-struct ext2_super_block
+struct __attribute__ ((packed)) ext2_super_block
{
uint32_t s_inodes_count; /* Inodes count */
uint32_t s_blocks_count; /* Blocks count */
diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c
index a49568b..01c224e 100644
--- a/libparted/fs/ext2/interface.c
+++ b/libparted/fs/ext2/interface.c
@@ -33,12 +33,13 @@ struct ext2_dev_handle* ext2_make_dev_handle_from_parted_geometry(PedGeometry* g
static PedGeometry*
_ext2_generic_probe (PedGeometry* geom, int expect_ext_ver)
{
+ struct ext2_super_block *sb;
const int sectors = (4096 + geom->dev->sector_size - 1) /
geom->dev->sector_size;
- char *sb_v = alloca (sectors * geom->dev->sector_size);
- if (!ped_geometry_read(geom, sb_v, 0, sectors))
+ uint8_t *buf = alloca (sectors * geom->dev->sector_size);
+ if (!ped_geometry_read(geom, buf, 0, sectors))
return NULL;
- struct ext2_super_block *sb = (struct ext2_super_block *)(sb_v + 1024);
+ sb = (struct ext2_super_block *)(buf+1024);
if (EXT2_SUPER_MAGIC(*sb) == EXT2_SUPER_MAGIC_CONST) {
PedSector block_size = (EXT2_MIN_BLOCK_SIZE << (EXT2_SUPER_LOG_BLOCK_SIZE(*sb))) / geom->dev->sector_size;