bianbu-linux-6.6/drivers/net/wireless
Gustavo A. R. Silva 02ae6a7034 wifi: cfg80211: 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 73 warnings like these:

drivers/net/wireless/intersil/orinoco/wext.c:1379:27: warning: cast from 'int (*)(struct net_device *, struct iw_request_info *, struct iw_param *, 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(SIOCGIWPOWER,        (iw_handler)orinoco_ioctl_getpower),
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../net/wireless/wext-compat.c:1607:33: warning: cast from 'int (*)(struct net_device *, struct iw_request_info *, struct iw_point *, 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_IOCTL_IDX(SIOCSIWGENIE)]    = (iw_handler) cfg80211_wext_siwgenie,
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/net/wireless/intersil/orinoco/wext.c:1390:27: error: incompatible function pointer types initializing 'const iw_handler' (aka 'int (*const)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *)') with an expression of type 'int (struct net_device *, struct iw_request_info *, struct iw_param *, char *)' [-Wincompatible-function-pointer-types]
        IW_HANDLER(SIOCGIWRETRY,        cfg80211_wext_giwretry),
                                        ^~~~~~~~~~~~~~~~~~~~~~

The cfg80211 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/234
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/a68822bf8dd587988131bb6a295280cb4293f05d.1667934775.git.gustavoars@kernel.org
2022-11-16 11:31:47 +02:00
..
admtek wifi: mac80211: add wake_tx_queue callback to drivers 2022-10-10 11:00:03 +02:00
ath wifi: Use kstrtobool() instead of strtobool() 2022-11-08 09:39:04 +02:00
atmel wifi: atmel: Fix atmel_private_handler array size 2022-11-01 12:30:22 +02:00
broadcom wifi: brcmfmac: Avoiding Connection delay 2022-11-08 09:38:24 +02:00
cisco airo: fix typos in comments 2022-03-16 17:30:40 +02:00
intel wifi: cfg80211: Avoid clashing function prototypes 2022-11-16 11:31:47 +02:00
intersil wifi: cfg80211: Avoid clashing function prototypes 2022-11-16 11:31:47 +02:00
marvell wifi: Use kstrtobool() instead of strtobool() 2022-11-08 09:39:04 +02:00
mediatek wireless-next patches for v6.2 2022-10-28 18:31:40 -07:00
microchip wifi: wilc1000: sdio: fix module autoloading 2022-11-01 13:07:34 +02:00
purelifi wifi: mac80211: add wake_tx_queue callback to drivers 2022-10-10 11:00:03 +02:00
quantenna treewide: use get_random_u32() when possible 2022-10-11 17:42:58 -06:00
ralink wifi: mac80211: add wake_tx_queue callback to drivers 2022-10-10 11:00:03 +02:00
realtek wifi: rtl8xxxu: Use u32_get_bits in *_identify_chip 2022-11-16 11:30:43 +02:00
rsi wifi: rsi: Fix handling of 802.3 EAPOL frames sent via control port 2022-11-08 09:41:02 +02:00
silabs wifi: mac80211: add wake_tx_queue callback to drivers 2022-10-10 11:00:03 +02:00
st wireless-next patches for v6.2 2022-10-28 18:31:40 -07:00
ti wireless-next patches for v6.2 2022-10-28 18:31:40 -07:00
zydas wifi: mac80211: add wake_tx_queue callback to drivers 2022-10-10 11:00:03 +02:00
Kconfig wireless: add plfxlc driver for pureLiFi X, XL, XC devices 2022-04-25 15:30:42 +03:00
mac80211_hwsim.c wireless-next patches for v6.2 2022-10-28 18:31:40 -07:00
mac80211_hwsim.h wifi: mac80211_hwsim: support creating MLO-capable radios 2022-06-20 12:57:09 +02:00
Makefile wireless: Fix Makefile to be in alphabetical order 2022-05-17 18:29:49 +03:00
ray_cs.c wifi: ray_cs: Drop useless status variable in parse_addr() 2022-06-08 11:08:34 +03:00
ray_cs.h
rayctl.h
rndis_wlan.c wifi: rndis_wlan: fix array of flexible structures warning 2022-09-22 09:08:53 +03:00
virt_wifi.c wifi: virt_wifi: fix typo in comment 2022-06-10 15:35:49 +02:00
wl3501.h
wl3501_cs.c wifi: move from strlcpy with unused retval to strscpy 2022-09-02 11:47:22 +03:00