1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/ethernet/atheros
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
..
alx alx: fix OOB-read compiler warning 2023-08-22 12:30:15 +02:00
atl1c ethernet: atheros: fix return value check in atl1c_tso_csum() 2023-07-24 10:39:11 +01:00
atl1e ethernet: atheros: fix return value check in atl1e_tso_csum() 2023-07-24 15:43:02 -07:00
atlx atheros: fix return value check in atl1_tso() 2023-07-24 15:37:56 -07:00
ag71xx.c net: Explicitly include correct DT includes 2023-07-27 20:33:16 -07:00
Kconfig net: selftest: fix build issue if INET is disabled 2021-04-28 14:06:45 -07:00
Makefile net: ethernet: add ag71xx driver 2019-05-26 13:22:50 -07:00