[U-Boot] [PATCH 1/1] net: avoid address-of-packed-member error

Tom Rini trini at konsulko.com
Mon Nov 4 21:15:46 UTC 2019


On Mon, Nov 04, 2019 at 09:28:51PM +0100, Simon Goldschmidt wrote:
> Am 04.11.2019 um 20:34 schrieb Heinrich Schuchardt:
> > struct ip_udp_hdr is naturally packed. There is no point in adding a
> > __packed attribute. With the attribute the network stack does not compile
> > using GCC 9.2.1:
> 
> Is this commit message correct? In lwIP, we *do* need to pack all these
> network header structs as they can come in unaligned. Especially the IP
> header is normally 16-bit aligned if the incoming Ethernet frame is 32-bit
> aligned (which is a must for many DMA engines).
> 
> This is also the reason why the below code works, I guess: it is rarely
> totally unaligned, but nearly always at least 16-bit aligned, so
> dereferencing the checksum pointer as aligned u16 just works.
> 
> Nevertheless, the code is formally wrong and your patch is correct. I just
> don't like the commit message saying 'packed' is not required.

Perhaps we should fix the underlying code problem then?  Or does that
men "rewrite the whole file" ?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191104/17264704/attachment.sig>


More information about the U-Boot mailing list