summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-04-29 11:44:02 +1000
committerNeilBrown <neilb@suse.de>2009-04-29 11:44:02 +1000
commitcaa0f6c623214231380c5ef0de91b53cc43d1e0b (patch)
treef2a986154d8c5e4e72aca7754dc67d788105e3a6 /bitmap.c
parent667e66d329168f205f0f67674910287fed982d87 (diff)
downloadmdadm-caa0f6c623214231380c5ef0de91b53cc43d1e0b.tar.gz
mdadm-caa0f6c623214231380c5ef0de91b53cc43d1e0b.tar.xz
mdadm-caa0f6c623214231380c5ef0de91b53cc43d1e0b.zip
Fix gcc-4.4 compiler warning.
Apparently the dereferencing of a type-punned pointer breaks strict aliasing rules. And we wouldn't want to do that. So just make a different array of the appropriate type and use memcpy. Resolves-Debian-bug: 505375 Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/bitmap.c b/bitmap.c
index 352be5d..5618087 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -270,6 +270,7 @@ int ExamineBitmap(char *filename, int brief, struct supertype *st)
int rv = 1;
char buf[64];
int swap;
+ __u32 uuid32[4];
info = bitmap_file_read(filename, brief, &st);
if (!info)
@@ -297,19 +298,20 @@ int ExamineBitmap(char *filename, int brief, struct supertype *st)
#else
swap = 1;
#endif
- if (swap) {
- printf(" UUID : %08x:%08x:%08x:%08x\n",
- swapl(*(__u32 *)(sb->uuid+0)),
- swapl(*(__u32 *)(sb->uuid+4)),
- swapl(*(__u32 *)(sb->uuid+8)),
- swapl(*(__u32 *)(sb->uuid+12)));
- } else {
- printf(" UUID : %08x:%08x:%08x:%08x\n",
- *(__u32 *)(sb->uuid+0),
- *(__u32 *)(sb->uuid+4),
- *(__u32 *)(sb->uuid+8),
- *(__u32 *)(sb->uuid+12));
- }
+ memcpy(uuid32, sb->uuid, 16);
+ if (swap)
+ printf(" UUID : %08x:%08x:%08x:%08x\n",
+ swapl(uuid32[0]),
+ swapl(uuid32[1]),
+ swapl(uuid32[2]),
+ swapl(uuid32[3]));
+ else
+ printf(" UUID : %08x:%08x:%08x:%08x\n",
+ uuid32[0],
+ uuid32[1],
+ uuid32[2],
+ uuid32[3]);
+
printf(" Events : %llu\n", (unsigned long long)sb->events);
printf(" Events Cleared : %llu\n", (unsigned long long)sb->events_cleared);
printf(" State : %s\n", bitmap_state(sb->state));