linux/drivers/net/hamradio
Nathan Chancellor c5733e5b15 hamradio: baycom_epp: Fix return type of baycom_send_packet()
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
indirect call targets are validated against the expected function
pointer prototype to make sure the call target is valid to help mitigate
ROP attacks. If they are not identical, there is a failure at run time,
which manifests as either a kernel panic or thread getting killed. A
proposed warning in clang aims to catch these at compile time, which
reveals:

  drivers/net/hamradio/baycom_epp.c:1119:25: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
          .ndo_start_xmit      = baycom_send_packet,
                                ^~~~~~~~~~~~~~~~~~
  1 error generated.

->ndo_start_xmit() in 'struct net_device_ops' expects a return type of
'netdev_tx_t', not 'int'. Adjust the return type of baycom_send_packet()
to match the prototype's to resolve the warning and CFI failure.

Link: https://github.com/ClangBuiltLinux/linux/issues/1750
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221102160610.1186145-1-nathan@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-11-03 20:57:13 -07:00
..
6pack.c hamradio: 6pack: fix array-index-out-of-bounds in decode_std_command() 2022-06-17 11:39:46 +01:00
baycom_epp.c hamradio: baycom_epp: Fix return type of baycom_send_packet() 2022-11-03 20:57:13 -07:00
baycom_par.c hamradio: use ndo_siocdevprivate 2021-07-27 20:11:44 +01:00
baycom_ser_fdx.c hamradio: use ndo_siocdevprivate 2021-07-27 20:11:44 +01:00
baycom_ser_hdx.c hamradio: use ndo_siocdevprivate 2021-07-27 20:11:44 +01:00
bpqether.c hamradio: use dev_addr_set() for setting device address 2021-10-13 09:41:37 -07:00
hdlcdrv.c treewide: use get_random_{u8,u16}() when possible, part 1 2022-10-11 17:42:58 -06:00
Kconfig net: hamradio: remove support for DMA SCC devices 2022-04-27 12:22:56 +01:00
Makefile net: hamradio: remove support for DMA SCC devices 2022-04-27 12:22:56 +01:00
mkiss.c TTY/Serial driver updates for 5.17-rc1 2022-01-12 11:21:52 -08:00
scc.c net: Don't include filter.h from net/sock.h 2021-12-29 08:48:14 -08:00
yam.c treewide: use get_random_{u8,u16}() when possible, part 1 2022-10-11 17:42:58 -06:00
z8530.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00