GONG, Ruiqi 3a198c95c9 alx: fix OOB-read compiler warning
The following message shows up when compiling with W=1:

In function ‘fortify_memcpy_chk’,
    inlined from ‘alx_get_ethtool_stats’ at drivers/net/ethernet/atheros/alx/ethtool.c:297:2:
./include/linux/fortify-string.h:592:4: error: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Werror=attribute-warning]
  592 |    __read_overflow2_field(q_size_field, size);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In order to get alx stats altogether, alx_get_ethtool_stats() reads
beyond hw->stats.rx_ok. Fix this warning by directly copying hw->stats,
and refactor the unnecessarily complicated BUILD_BUG_ON btw.

Signed-off-by: GONG, Ruiqi <gongruiqi1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230821013218.1614265-1-gongruiqi@huaweicloud.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-08-22 12:30:15 +02:00
..
2023-08-13 08:50:26 -07:00
2023-06-29 11:00:17 -07:00
2023-07-06 09:56:53 -07:00
2023-06-29 08:09:31 -06:00
2023-08-12 02:36:28 +03:00
2023-07-26 11:47:57 -07:00
2023-08-07 00:01:41 +05:30
2023-08-18 06:57:38 +10:00
2023-07-13 19:13:24 -07:00
2023-07-08 12:28:00 -07:00
2023-06-29 15:28:33 -07:00
2023-08-08 14:59:49 -07:00
2023-07-03 10:55:04 -07:00
2023-08-22 12:30:15 +02:00
2023-08-11 12:14:08 -07:00
2023-06-15 13:42:18 +02:00
2023-08-11 09:39:17 -07:00
2023-07-13 00:05:52 +02:00
2023-07-05 12:55:06 -07:00
2023-07-03 17:03:05 -07:00
2023-06-29 15:22:19 -07:00
2023-07-03 10:43:10 -07:00
2023-08-13 08:43:26 -07:00
2023-07-30 11:47:56 -07:00
2023-07-08 12:35:18 -07:00
2023-06-29 15:22:19 -07:00
2023-07-30 11:51:36 -07:00
2023-07-27 07:53:12 +02:00