Re: [PATCH] drivers: staging: lustre: lustre: include: add "__attribute__((packed))" for the related union

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ah.  From so metag is a new arch and not a compiler like the changelog
says.

On Mon, Jan 20, 2014 at 11:56:47AM +0000, James Hogan wrote:
> struct a {
> 	struct b {
> 		unsigned int x;
> 		unsigned short y;
> 	} x;
> 	unsigned short y;
> } __packed;

This is not the code we are discussing.  It should look like:

struct a {
	union {
		short x;
		short y;
	}
	short z;
};

Any normal person would assume that sizeof(struct a) would be 4 but
apparently on metag it is 8.  That totally defeats the point of using
a union in the first place.  It's easy enough to add a __packed to the
lustre declaration but I expect this to cause an endless stream of bugs.

It it is really stupid.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux