On Mon, Oct 17, 2022 at 03:33:01PM -0500, Gustavo A. R. Silva wrote: > 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 53 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, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Thank you for working on these! Was this conversion done manually, via coccinelle, or something else? > The orinoco 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. No significant binary differences were seen > before/after changes. What does "significant" mean here? :P Anything related to line counts can just be ignored. But I'd expect the .text output of drivers/net/wireless/intersil/orinoco/wext.o before/after to be identical. > [...] > IW_HANDLER(SIOCSIWRTS, (iw_handler)cfg80211_wext_siwrts), ^^^ I think these are fixed explicitly later, but maybe better to just collapse them into this patch? > [...] > @@ -1391,15 +1406,15 @@ static const iw_handler orinoco_handler[] = { > Added typecasting since we no longer use iwreq_data -- Moustafa > */ > static const iw_handler orinoco_private_handler[] = { > - [0] = (iw_handler)orinoco_ioctl_reset, > - [1] = (iw_handler)orinoco_ioctl_reset, > - [2] = (iw_handler)orinoco_ioctl_setport3, > - [3] = (iw_handler)orinoco_ioctl_getport3, > - [4] = (iw_handler)orinoco_ioctl_setpreamble, > - [5] = (iw_handler)orinoco_ioctl_getpreamble, > - [6] = (iw_handler)orinoco_ioctl_setibssport, > - [7] = (iw_handler)orinoco_ioctl_getibssport, > - [9] = (iw_handler)orinoco_ioctl_getrid, > + [0] = orinoco_ioctl_reset, > + [1] = orinoco_ioctl_reset, > + [2] = orinoco_ioctl_setport3, > + [3] = orinoco_ioctl_getport3, > + [4] = orinoco_ioctl_setpreamble, > + [5] = orinoco_ioctl_getpreamble, > + [6] = orinoco_ioctl_setibssport, > + [7] = orinoco_ioctl_getibssport, > + [9] = orinoco_ioctl_getrid, Oops, I broke atmel. These really are 0-indexed... static const iw_handler atmel_private_handler[] = { - NULL, /* SIOCIWFIRSTPRIV */ + IW_HANDLER(SIOCIWFIRSTPRIV, NULL), }; I'll send a fix! -- Kees Cook