[Top][All Lists]

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

[lwip-devel] [bug #50883] struct eth_addr alignment error

From: Daniel Elstner
Subject: [lwip-devel] [bug #50883] struct eth_addr alignment error
Date: Wed, 26 Apr 2017 10:13:17 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/57.0.2987.98 Chrome/57.0.2987.98 Safari/537.36


                 Summary: struct eth_addr alignment error
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: danielk
            Submitted on: Wed 26 Apr 2017 04:13:16 PM CEST
                Category: ARP
                Severity: 3 - Normal
              Item Group: Crash Error
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head



I tracked down a crash in my project to an alignment fault in etharp_raw(). In
the crashing case one of the arguments points to the global constant ethzero,
which is a struct eth_addr. This struct has only 8-bit members so the compiler
is free to place it at any byte address. Since I define ETHADDR16_COPY() to
use 16-bit reads/writes, an alignment exception is triggered.

The minimum alignment could be changed by making the type a union including
some u16_t members, or a compiler attribute could be used. However, that would
still not help if struct packing is enabled (it would work for me only because
I happen to disable it).

I think it's wrong for the ARP code to use the same packed type from the proto
header for its own local/global variables.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]