OSDN Git Service

sfc: use padding to fix alignment in loopback test
authorEdward Cree <ecree.xilinx@gmail.com>
Fri, 23 Jun 2023 18:38:04 +0000 (19:38 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Jun 2023 09:36:48 +0000 (10:36 +0100)
commitcf60ed469629927fe43c2f4b4ef28a563d991935
treeedd09b5a926943ef4efe2bdcd5cad4d8c59e9cb9
parent9ae440b8fdd6772b6c007fa3d3766530a09c9045
sfc: use padding to fix alignment in loopback test

Add two bytes of padding to the start of struct efx_loopback_payload,
 which are not sent on the wire.  This ensures the 'ip' member is
 4-byte aligned, preventing the following W=1 warning:
net/ethernet/sfc/selftest.c:46:15: error: field ip within 'struct efx_loopback_payload' is less aligned than 'struct iphdr' and is usually due to 'struct efx_loopback_payload' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
        struct iphdr ip;

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/selftest.c