bianbu-linux-6.6/drivers/net/wireless/intel/ipw2x00
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
..
ipw.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ipw2100.c wifi: ipw2100: fix warnings about non-kernel-doc 2022-09-07 11:02:58 +03:00
ipw2100.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 507 2019-06-19 17:11:23 +02:00
ipw2200.c wifi: cfg80211: Avoid clashing function prototypes 2022-11-16 11:31:47 +02:00
ipw2200.h ipw2x00: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 2022-09-28 09:44:48 +03:00
Kconfig net: wireless: drop bogus CRYPTO_xxx Kconfig selects 2020-09-11 14:39:16 +10:00
libipw.h wifi: ipw2x00: fix array of flexible structures warnings 2022-09-22 09:08:52 +03:00
libipw_geo.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 507 2019-06-19 17:11:23 +02:00
libipw_module.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
libipw_rx.c wifi: ipw2x00: fix array of flexible structures warnings 2022-09-22 09:08:52 +03:00
libipw_tx.c ipw2x00: Fix potential NULL dereference in libipw_xmit() 2022-04-06 15:14:44 +03:00
libipw_wx.c ipw2x00: potential buffer overflow in libipw_wx_set_encodeext() 2021-04-17 20:35:44 +03:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00