module: explicitly align module_version_attribute structure
authorDmitry Torokhov <dtor@vmware.com>
Fri, 4 Feb 2011 21:30:10 +0000 (13:30 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 21 Feb 2011 23:21:53 +0000 (15:21 -0800)
We force particular alignment when we generate attribute structures
when generation MODULE_VERSION() data and we need to make sure that
this alignment is followed when we iterate over these structures,
otherwise we may crash on platforms whose natural alignment is not
sizeof(void *), such as m68k.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
[ There are more issues here, but the fixes are incredibly ugly - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/module.h

index 9bdf27c..5de4204 100644 (file)
@@ -62,7 +62,7 @@ struct module_version_attribute {
        struct module_attribute mattr;
        const char *module_name;
        const char *version;
-};
+} __attribute__ ((__aligned__(sizeof(void *))));
 
 struct module_kobject
 {