48 lines
1.7 KiB
Diff
48 lines
1.7 KiB
Diff
From 1e086dba260630b63e0822731522ce04c081d95e Mon Sep 17 00:00:00 2001
|
|
From: "Brian C. Lane" <bcl@redhat.com>
|
|
Date: Tue, 10 Nov 2020 14:39:06 -0800
|
|
Subject: [PATCH 30/42] ext2: Fix gcc 10 warnings about cast alignment
|
|
|
|
---
|
|
libparted/fs/ext2/ext2_fs.h | 2 +-
|
|
libparted/fs/ext2/interface.c | 7 ++++---
|
|
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;
|
|
--
|
|
2.26.2
|
|
|