drivers/net/ethernet/sfc/selftest.c:48:16: warning: field ip within 'struct efx_loopback_payload::(anonymous at drivers/net/ethernet/sfc/selftest.c:46:2)' is less aligned than 'struct iphdr' and is usually due to 'struct efx_loopback_payload::(anonymous a...

From: kernel test robot
Date: Sun Aug 27 2023 - 16:34:59 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 85eb043618bb17124050197d71c453d4a1f556e5
commit: 55c1528f9b97ff3b7efad73e8f79627fc2efb298 sfc: fix field-spanning memcpy in selftest
date: 4 weeks ago
config: arm-randconfig-r001-20230828 (https://download.01.org/0day-ci/archive/20230828/202308280404.zWFYpWWE-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230828/202308280404.zWFYpWWE-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308280404.zWFYpWWE-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/sfc/selftest.c:48:16: warning: field ip within 'struct efx_loopback_payload::(anonymous at drivers/net/ethernet/sfc/selftest.c:46:2)' is less aligned than 'struct iphdr' and is usually due to 'struct efx_loopback_payload::(anonymous at drivers/net/ethernet/sfc/selftest.c:46:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
48 | struct iphdr ip;
| ^
>> drivers/net/ethernet/sfc/selftest.c:48:16: warning: field ip within 'struct efx_loopback_payload::(unnamed at drivers/net/ethernet/sfc/selftest.c:46:2)' is less aligned than 'struct iphdr' and is usually due to 'struct efx_loopback_payload::(unnamed at drivers/net/ethernet/sfc/selftest.c:46:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
2 warnings generated.


vim +48 drivers/net/ethernet/sfc/selftest.c

93e5dfa59b0e26a drivers/net/ethernet/sfc/selftest.c Ben Hutchings 2012-02-28 37
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 38 /*
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 39 * Loopback test packet structure
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 40 *
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 41 * The self-test should stress every RSS vector, and unfortunately
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 42 * Falcon only performs RSS on TCP/UDP packets.
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 43 */
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 44 struct efx_loopback_payload {
cf60ed469629927 drivers/net/ethernet/sfc/selftest.c Edward Cree 2023-06-23 45 char pad[2]; /* Ensures ip is 4-byte aligned */
55c1528f9b97ff3 drivers/net/ethernet/sfc/selftest.c Edward Cree 2023-07-28 46 struct_group_attr(packet, __packed,
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 47 struct ethhdr header;
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 @48 struct iphdr ip;
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 49 struct udphdr udp;
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 50 __be16 iteration;
1d20a16062e771b drivers/net/ethernet/sfc/selftest.c David S. Miller 2015-04-17 51 char msg[64];
55c1528f9b97ff3 drivers/net/ethernet/sfc/selftest.c Edward Cree 2023-07-28 52 );
cf60ed469629927 drivers/net/ethernet/sfc/selftest.c Edward Cree 2023-06-23 53 } __packed __aligned(4);
55c1528f9b97ff3 drivers/net/ethernet/sfc/selftest.c Edward Cree 2023-07-28 54 #define EFX_LOOPBACK_PAYLOAD_LEN \
55c1528f9b97ff3 drivers/net/ethernet/sfc/selftest.c Edward Cree 2023-07-28 55 sizeof_field(struct efx_loopback_payload, packet)
3273c2e8c66a21a drivers/net/sfc/selftest.c Ben Hutchings 2008-05-07 56

:::::: The code at line 48 was first introduced by commit
:::::: 3273c2e8c66a21ae1c53b0c730ee937c6efde7e2 [netdrvr] sfc: sfc: Add self-test support

:::::: TO: Ben Hutchings <bhutchings@xxxxxxxxxxxxxx>
:::::: CC: Jeff Garzik <jgarzik@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki