OSDN Git Service

wifi: airo: Avoid clashing function prototypes
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 8 Nov 2022 20:27:49 +0000 (14:27 -0600)
committerKalle Valo <kvalo@kernel.org>
Wed, 16 Nov 2022 09:31:48 +0000 (11:31 +0200)
commit89e706459848a7cc80f222a1999c0bfcdf63289f
tree22bbd5bc28094c52b16b27441fd6d97ab09f9b46
parentff7efc66b7ea7bd2e575b3d56e24628b2f418315
wifi: airo: 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 32 warnings like these:

../drivers/net/wireless/cisco/airo.c:7570:2: warning: cast from 'int (*)(struct net_device *, struct iw_request_info *, void *, 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) airo_config_commit,        /* SIOCSIWCOMMIT */
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The airo 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/236
Link: https://reviews.llvm.org/D134831
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/820abf91d12809904696ddb8925ec5e1e0da3e4c.1667934775.git.gustavoars@kernel.org
drivers/net/wireless/cisco/airo.c