parted/0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch
DistroBaker b7125dc640 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/parted.git#633c371306f0da38c70879e948b612775032740a
2020-12-01 18:08:09 +00:00

40 lines
1.1 KiB
Diff

From e2ee2628c5d75b375db90a486b906c0d2405b8b3 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 12 Nov 2020 16:18:42 -0800
Subject: [PATCH 32/42] ntfs: Fix gcc 10 warnings about cast alignment
---
libparted/fs/ntfs/ntfs.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libparted/fs/ntfs/ntfs.c b/libparted/fs/ntfs/ntfs.c
index 3bfb28e..a3a6550 100644
--- a/libparted/fs/ntfs/ntfs.c
+++ b/libparted/fs/ntfs/ntfs.c
@@ -35,16 +35,17 @@
PedGeometry*
ntfs_probe (PedGeometry* geom)
{
- char *buf = alloca (geom->dev->sector_size);
+ uint8_t *buf = alloca(geom->dev->sector_size);
PedGeometry *newg = NULL;
if (!ped_geometry_read(geom, buf, 0, 1))
return 0;
- if (strncmp (NTFS_SIGNATURE, buf + 3, strlen (NTFS_SIGNATURE)) == 0)
- newg = ped_geometry_new (geom->dev, geom->start,
- PED_LE64_TO_CPU (*(uint64_t*)
- (buf + 0x28)));
+ if (strncmp (NTFS_SIGNATURE, ((char *)buf + 3), strlen (NTFS_SIGNATURE)) == 0) {
+ uint64_t length;
+ memcpy(&length, buf + 0x28, sizeof(uint64_t));
+ newg = ped_geometry_new (geom->dev, geom->start, length);
+ }
return newg;
}
--
2.26.2