linux/drivers/net/ethernet/asix
Dmitry Antipov 2a62644800 net: asix: fix fortify warning
When compiling with gcc version 14.0.0 20231129 (experimental) and
CONFIG_FORTIFY_SOURCE=y, I've noticed the following warning:

...
In function 'fortify_memcpy_chk',
    inlined from 'ax88796c_tx_fixup' at drivers/net/ethernet/asix/ax88796c_main.c:287:2:
./include/linux/fortify-string.h:588:25: warning: call to '__read_overflow2_field'
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Wattribute-warning]
  588 |                         __read_overflow2_field(q_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

This call to 'memcpy()' is interpreted as an attempt to copy TX_OVERHEAD
(which is 8) bytes from 4-byte 'sop' field of 'struct tx_pkt_info' and
thus overread warning is issued. Since we actually want to copy both
'sop' and 'seg' fields at once, use the convenient 'struct_group()' here.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Łukasz Stelmach <l.stelmach@samsung.com>
Link: https://lore.kernel.org/r/20231211090535.9730-1-dmantipov@yandex.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-12-12 13:20:37 -08:00
..
ax88796c_ioctl.c net: ax88796c: replace deprecated strncpy with strscpy 2023-10-06 15:55:29 -07:00
ax88796c_ioctl.h
ax88796c_main.c net: asix: fix fortify warning 2023-12-12 13:20:37 -08:00
ax88796c_main.h net: asix: fix fortify warning 2023-12-12 13:20:37 -08:00
ax88796c_spi.c net: ax88796c: do not receive data in pointer 2021-11-22 14:32:05 +00:00
ax88796c_spi.h
Kconfig
Makefile