Skip to content

Commit 4f39a1f

Browse files
committed
wireless: wext: use struct iwreq earlier in the call chain
To make it clear that we never use struct ifreq, cast from it directly in the wext entrypoint and use struct iwreq from there on. The next patch will remove the cast again and pass the correct struct from the beginning. Signed-off-by: Johannes Berg <[email protected]>
1 parent 8bfb367 commit 4f39a1f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

net/wireless/wext-core.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -914,21 +914,20 @@ int call_commit_handler(struct net_device *dev)
914914
* Main IOCTl dispatcher.
915915
* Check the type of IOCTL and call the appropriate wrapper...
916916
*/
917-
static int wireless_process_ioctl(struct net *net, struct ifreq *ifr,
917+
static int wireless_process_ioctl(struct net *net, struct iwreq *iwr,
918918
unsigned int cmd,
919919
struct iw_request_info *info,
920920
wext_ioctl_func standard,
921921
wext_ioctl_func private)
922922
{
923-
struct iwreq *iwr = (struct iwreq *) ifr;
924923
struct net_device *dev;
925924
iw_handler handler;
926925

927926
/* Permissions are already checked in dev_ioctl() before calling us.
928927
* The copy_to/from_user() of ifr is also dealt with in there */
929928

930929
/* Make sure the device exist */
931-
if ((dev = __dev_get_by_name(net, ifr->ifr_name)) == NULL)
930+
if ((dev = __dev_get_by_name(net, iwr->ifr_name)) == NULL)
932931
return -ENODEV;
933932

934933
/* A bunch of special cases, then the generic case...
@@ -974,7 +973,7 @@ static int wext_permission_check(unsigned int cmd)
974973
}
975974

976975
/* entry point from dev ioctl */
977-
static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr,
976+
static int wext_ioctl_dispatch(struct net *net, struct iwreq *iwr,
978977
unsigned int cmd, struct iw_request_info *info,
979978
wext_ioctl_func standard,
980979
wext_ioctl_func private)
@@ -984,9 +983,9 @@ static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr,
984983
if (ret)
985984
return ret;
986985

987-
dev_load(net, ifr->ifr_name);
986+
dev_load(net, iwr->ifr_name);
988987
rtnl_lock();
989-
ret = wireless_process_ioctl(net, ifr, cmd, info, standard, private);
988+
ret = wireless_process_ioctl(net, iwr, cmd, info, standard, private);
990989
rtnl_unlock();
991990

992991
return ret;
@@ -1042,7 +1041,7 @@ int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
10421041
struct iw_request_info info = { .cmd = cmd, .flags = 0 };
10431042
int ret;
10441043

1045-
ret = wext_ioctl_dispatch(net, ifr, cmd, &info,
1044+
ret = wext_ioctl_dispatch(net, (void *)ifr, cmd, &info,
10461045
ioctl_standard_call,
10471046
ioctl_private_call);
10481047
if (ret >= 0 &&
@@ -1104,7 +1103,7 @@ int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
11041103
info.cmd = cmd;
11051104
info.flags = IW_REQUEST_FLAG_COMPAT;
11061105

1107-
ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd, &info,
1106+
ret = wext_ioctl_dispatch(net, &iwr, cmd, &info,
11081107
compat_standard_call,
11091108
compat_private_call);
11101109

0 commit comments

Comments
 (0)