I made a quick and dirty sparse patch to check for this. I don't think I will bother trying to send it to sparse upstream, but you can if you want to. It found 289 unions which might need a __packed added. The lustre unions were not in my allmodconfig so they're not listed. Perhaps there could be a command line option or a pragma so that unions will work in the kernel. We don't care about linking to outside libraries. regards, dan carpenter diff --git a/symbol.c b/symbol.c index ebba56deaf94..596e47883aad 100644 --- a/symbol.c +++ b/symbol.c @@ -187,6 +187,12 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advance bit_size = (bit_size + bit_align) & ~bit_align; } sym->bit_size = bit_size; + + if (!advance && (info.bit_size / 8) % 4) { + int pad = 4 - (info.bit_size / 8) % 4; + warning(sym->pos, "'%s' union will be padded with %d bytes unless __attribute__((packed)).", sym->ident ? sym->ident->name: "", pad); + } + return sym; }