Search Linux Wireless

Re: [RFC/RFT] p54: Fix sparse warnings

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

 



On Friday 12 September 2008 20:36:03 Michael Buesch wrote:
> On Friday 12 September 2008 20:16:03 Larry Finger wrote:
> >  struct bootrec {
> >  	__le32 code;
> >  	__le32 len;
> > -	u32 data[0];
> > +	/* Most references to the data section that follows are for u32
> > +	 * quantities; however, one is for an le16 quantity. The union
> > +	 * below avoids a cast and makes the usage clearer. */
> > +	union {
> > +		u32 data[0];
> > +		__le16 data16[0];
> > +	};
> >  } __attribute__((packed));
> 
> I suggest you change
> 	u32 data[0];
> to
> 	__le32 data_le32[0];
> and also add
> 	__be32 data_be32[0];
> to the union. This avoids another few casts.
> (Maybe you don't even need the __le32 variant. I didn't check all the code).

Ah and I think you should also add packed attribute to the union
to tell the compiler to avoid any padding.

-- 
Greetings Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux