]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
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 f908d27bed2c49ffa25eec4cfc661d2bcdd5950b..2f6e7992b8e79277ecac4c72f3fbf8fd31f70d02 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)