mirror_ubuntu-kernels/drivers/net/wireless/intersil/hostap
Gustavo A. R. Silva fd7ef879a9 wifi: hostap: Avoid clashing function prototypes
When built with Control Flow Integrity, function prototypes between
caller and function declaration must match. These mismatches are visible
at compile time with the new -Wcast-function-type-strict in Clang[1].

Fix a total of 42 warnings like these:

../drivers/net/wireless/intersil/hostap/hostap_ioctl.c:3868:2: warning: cast from 'int (*)(struct net_device *, struct iw_request_info *, char *, char *)' to 'iw_handler' (aka 'int (*)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *)') converts to incompatible function type [-Wcast-function-type-strict]
        (iw_handler) prism2_get_name,                   /* SIOCGIWNAME */
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

The hostap Wireless Extension handler callbacks (iw_handler) use a
union for the data argument. Actually use the union and perform explicit
member selection in the function body instead of having a function
prototype mismatch. There are no resulting binary differences
before/after changes.

These changes were made partly manually and partly with the help of
Coccinelle.

Link: https://github.com/KSPP/linux/issues/235
Link: https://reviews.llvm.org/D134831 [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/e480e7713f1a4909ae011068c8d793cc4a638fbd.1667934775.git.gustavoars@kernel.org
2022-11-16 11:31:47 +02:00
..
hostap_80211_rx.c
hostap_80211_tx.c
hostap_80211.h
hostap_ap.c proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
hostap_ap.h
hostap_common.h hostap: Replace zero-length array with flexible-array member 2020-03-23 18:59:15 +02:00
hostap_config.h
hostap_cs.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
hostap_download.c proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
hostap_hw.c intersil: Use struct_group() for memcpy() region 2021-11-29 12:45:17 +02:00
hostap_info.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
hostap_ioctl.c wifi: hostap: Avoid clashing function prototypes 2022-11-16 11:31:47 +02:00
hostap_main.c wireless: use eth_hw_addr_set() 2021-10-20 12:39:42 +03:00
hostap_pci.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
hostap_plx.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
hostap_proc.c proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
hostap_wlan.h intersil: Use struct_group() for memcpy() region 2021-11-29 12:45:17 +02:00
hostap.h hostap: use ndo_siocdevprivate 2021-07-27 20:11:43 +01:00
Kconfig net: wireless: drop bogus CRYPTO_xxx Kconfig selects 2020-09-11 14:39:16 +10:00
Makefile