Fix unaligned memory access
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Wed, 21 Dec 2011 20:23:58 +0000 (18:23 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 21 Dec 2011 20:37:46 +0000 (18:37 -0200)
Bug found on sparc64. Thanks to "Jan Engelhardt <jengelh@medozas.de>"
for providing access to such a machine.

libkmod/libkmod-index.c

index f908d27..2f6e799 100644 (file)
@@ -669,7 +669,7 @@ static struct index_mm_node *index_mm_read_node(struct index_mm *idx,
                child_count = 0;
        }
 
-       children_padding = (offsetof(struct index_mm_node, children) +
+       children_padding = (sizeof(struct index_mm_node) +
                            (sizeof(uint32_t) * child_count)) % sizeof(void *);
 
        if (offset & INDEX_NODE_VALUES)