Re: [PATCH] ALSA: compress: Fix the mismatch size of struc between share lib(32bit) and kernel(64bit)

From: Arnd Bergmann
Date: Tue Jun 17 2014 - 07:49:17 EST


On Tuesday 17 June 2014, Vinod Koul wrote:
> > Anyway, if you use the __packed attribute, best apply it only to
> > the individual __u64 member(s), not the entire struct, otherwise
> > you might change user space programs in a subtle way when the alignment
> > changes from 4 to 1 byte.
>
> then wouldn't it make sense to call out the aligned as well to ensure that it is
> aligning to what we want. Then we should add aligned (4) everywhere as mostly we
> need 4 byte aligned here

If you want to be explicit, then just mark the entire structure as
attribute((packed,aligned(4))), not each individual member.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/