[Pkg-utopia-maintainers] Bug#708286: fix unaligned access warnings on big endian machines

Helge Deller deller at gmx.de
Tue May 14 19:57:51 UTC 2013


Package: udisks
Version: 1.0.4-7

On big endian machines (in my case parisc) unaligned accesses to 32bit
integers gives warnings during boot like this:

udisks-part-id(3035): unaligned access to 0xc06d29ce at ip=0x00012a03
udisks-part-id(3035): unaligned access to 0xc06d29d2 at ip=0x00012a3b
udisks-part-id(3035): unaligned access to 0xc06d29de at ip=0x00012a03
udisks-part-id(3035): unaligned access to 0xc06d29e2 at ip=0x00012a3b
udisks-part-id(3035): unaligned access to 0xc06d29ee at ip=0x00012a03

Fix this by copying the 4 bytes to an aligned address and then access it.

Patch attached.

I did reported the bug upstream as well:
https://bugs.freedesktop.org/show_bug.cgi?id=64601
-------------- next part --------------
Description: fix unaligned access warnings on big endian machines

 On big endian machines (in my case parisc) unaligned accesses to 32bit
 integers gives warnings during boot like this:

 udisks-part-id(3035): unaligned access to 0xc06d29ce at ip=0x00012a03
 udisks-part-id(3035): unaligned access to 0xc06d29d2 at ip=0x00012a3b
 udisks-part-id(3035): unaligned access to 0xc06d29de at ip=0x00012a03
 udisks-part-id(3035): unaligned access to 0xc06d29e2 at ip=0x00012a3b
 udisks-part-id(3035): unaligned access to 0xc06d29ee at ip=0x00012a03

 Fix this by copying the 4 bytes to an aligned address and then access
 it.

Author: Helge Deller <deller at gmx.de>

--- udisks-1.0.4.orig/src/helpers/partutil.c
+++ udisks-1.0.4/src/helpers/partutil.c
@@ -181,7 +181,9 @@ get_le16 (const void *buf)
 static guint32
 get_le32 (const void *buf)
 {
-  return GUINT32_FROM_LE (*((guint32 *) buf));
+  guint32 le32;
+  memcpy(&le32, buf, sizeof(le32));
+  return GUINT32_FROM_LE (le32);
 }
 
 static guint64


More information about the Pkg-utopia-maintainers mailing list