drivers/net/ethernet/sfc/falcon/selftest.c:45:16: warning: field ip within 'struct ef4_loopback_payload::(anonymous at drivers/net/ethernet/sfc/falcon/selftest.c:43:2)' is less aligned than 'struct iphdr' and is usually due to 'struct ef4_loopback_payload...

From: kernel test robot
Date: Tue Aug 15 2023 - 08:32:03 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 91aa6c412d7f85e48aead7b00a7d9e91f5cf5863
commit: 55c1528f9b97ff3b7efad73e8f79627fc2efb298 sfc: fix field-spanning memcpy in selftest
date: 2 weeks ago
config: arm-randconfig-r011-20230815 (https://download.01.org/0day-ci/archive/20230815/202308152020.SxCOJiOI-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/20230815/202308152020.SxCOJiOI-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/202308152020.SxCOJiOI-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

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


vim +45 drivers/net/ethernet/sfc/falcon/selftest.c

5a6681e22c1409 Edward Cree 2016-11-28 34
5a6681e22c1409 Edward Cree 2016-11-28 35 /*
5a6681e22c1409 Edward Cree 2016-11-28 36 * Loopback test packet structure
5a6681e22c1409 Edward Cree 2016-11-28 37 *
5a6681e22c1409 Edward Cree 2016-11-28 38 * The self-test should stress every RSS vector, and unfortunately
5a6681e22c1409 Edward Cree 2016-11-28 39 * Falcon only performs RSS on TCP/UDP packets.
5a6681e22c1409 Edward Cree 2016-11-28 40 */
5a6681e22c1409 Edward Cree 2016-11-28 41 struct ef4_loopback_payload {
1186c6b31ee14f Edward Cree 2023-06-23 42 char pad[2]; /* Ensures ip is 4-byte aligned */
55c1528f9b97ff Edward Cree 2023-07-28 43 struct_group_attr(packet, __packed,
5a6681e22c1409 Edward Cree 2016-11-28 44 struct ethhdr header;
5a6681e22c1409 Edward Cree 2016-11-28 @45 struct iphdr ip;
5a6681e22c1409 Edward Cree 2016-11-28 46 struct udphdr udp;
5a6681e22c1409 Edward Cree 2016-11-28 47 __be16 iteration;
5a6681e22c1409 Edward Cree 2016-11-28 48 char msg[64];
55c1528f9b97ff Edward Cree 2023-07-28 49 );
1186c6b31ee14f Edward Cree 2023-06-23 50 } __packed __aligned(4);
55c1528f9b97ff Edward Cree 2023-07-28 51 #define EF4_LOOPBACK_PAYLOAD_LEN \
55c1528f9b97ff Edward Cree 2023-07-28 52 sizeof_field(struct ef4_loopback_payload, packet)
5a6681e22c1409 Edward Cree 2016-11-28 53

:::::: The code at line 45 was first introduced by commit
:::::: 5a6681e22c1409089132085811857d6da828761b sfc: separate out SFC4000 ("Falcon") support into new sfc-falcon driver

:::::: TO: Edward Cree <ecree@xxxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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