Commit 090014ee authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: the rest of ifr_data cleanups and annotations

	The rest of ->ifr_data cleanups.  A bunch of drivers use address
of ifr->ifr_ifru, but spell that as &ifr->ifr_data, which expands to
&ifr->ifr_ifru.ifru_data.  ifr_ifru is a union and in effect they sneak in
a private field into that union; ifr_ifru.ifru_data is a field in that
union and it has nothing to do with the things they want to do.  Cleaned
up by explicit use of &ifr->ifr_ifru.

	Several places where we really use ->ifr_data (i.e. use its value
and use it as __user pointer) annotated.
parent a086d60f
......@@ -524,7 +524,7 @@ static void cops_reset(struct net_device *dev, int sleep)
static void cops_load (struct net_device *dev)
{
struct ifreq ifr;
struct ltfirmware *ltf= (struct ltfirmware *)&ifr.ifr_data;
struct ltfirmware *ltf= (struct ltfirmware *)&ifr.ifr_ifru;
struct cops_local *lp = netdev_priv(dev);
int ioaddr=dev->base_addr;
int length, i = 0;
......
......@@ -259,7 +259,7 @@ static struct ipddp_route* ipddp_find_route(struct ipddp_route *rt)
static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
struct ipddp_route *rt = (struct ipddp_route *)ifr->ifr_data;
struct ipddp_route __user *rt = ifr->ifr_data;
struct ipddp_route rcp;
if(!capable(CAP_NET_ADMIN))
......
......@@ -1269,7 +1269,7 @@ static void set_rx_mode(struct net_device *dev)
static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
u16 *data = (u16 *)&rq->ifr_data;
u16 *data = (u16 *)&rq->ifr_ifru;
/* fixme */
switch(cmd) {
......
......@@ -1937,7 +1937,7 @@ static void depca_dbg_open(struct net_device *dev)
static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct depca_private *lp = (struct depca_private *) dev->priv;
struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_data;
struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_ifru;
int i, status = 0;
u_long ioaddr = dev->base_addr;
union {
......
......@@ -1325,7 +1325,7 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{
int phy_addr;
struct netdev_private *np = dev->priv;
struct mii_data *miidata = (struct mii_data *) &rq->ifr_data;
struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru;
struct netdev_desc *desc;
int i;
......
......@@ -255,14 +255,14 @@ static int eql_close(struct net_device *dev)
return 0;
}
static int eql_enslave(struct net_device *dev, slaving_request_t *srq);
static int eql_emancipate(struct net_device *dev, slaving_request_t *srq);
static int eql_enslave(struct net_device *dev, slaving_request_t __user *srq);
static int eql_emancipate(struct net_device *dev, slaving_request_t __user *srq);
static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *sc);
static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *sc);
static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *sc);
static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *sc);
static int eql_g_master_cfg(struct net_device *dev, master_config_t *mc);
static int eql_s_master_cfg(struct net_device *dev, master_config_t *mc);
static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mc);
static int eql_s_master_cfg(struct net_device *dev, master_config_t __user *mc);
static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
......@@ -272,23 +272,17 @@ static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
switch (cmd) {
case EQL_ENSLAVE:
return eql_enslave(dev,
(slaving_request_t *) ifr->ifr_data);
return eql_enslave(dev, ifr->ifr_data);
case EQL_EMANCIPATE:
return eql_emancipate(dev,
(slaving_request_t *) ifr->ifr_data);
return eql_emancipate(dev, ifr->ifr_data);
case EQL_GETSLAVECFG:
return eql_g_slave_cfg(dev,
(slave_config_t *) ifr->ifr_data);
return eql_g_slave_cfg(dev, ifr->ifr_data);
case EQL_SETSLAVECFG:
return eql_s_slave_cfg(dev,
(slave_config_t *) ifr->ifr_data);
return eql_s_slave_cfg(dev, ifr->ifr_data);
case EQL_GETMASTRCFG:
return eql_g_master_cfg(dev,
(master_config_t *) ifr->ifr_data);
return eql_g_master_cfg(dev, ifr->ifr_data);
case EQL_SETMASTRCFG:
return eql_s_master_cfg(dev,
(master_config_t *) ifr->ifr_data);
return eql_s_master_cfg(dev, ifr->ifr_data);
default:
return -EOPNOTSUPP;
};
......@@ -411,7 +405,7 @@ static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave)
return -ENOSPC;
}
static int eql_enslave(struct net_device *master_dev, slaving_request_t *srqp)
static int eql_enslave(struct net_device *master_dev, slaving_request_t __user *srqp)
{
struct net_device *slave_dev;
slaving_request_t srq;
......@@ -457,7 +451,7 @@ static int eql_enslave(struct net_device *master_dev, slaving_request_t *srqp)
return -EINVAL;
}
static int eql_emancipate(struct net_device *master_dev, slaving_request_t *srqp)
static int eql_emancipate(struct net_device *master_dev, slaving_request_t __user *srqp)
{
equalizer_t *eql = master_dev->priv;
struct net_device *slave_dev;
......@@ -489,7 +483,7 @@ static int eql_emancipate(struct net_device *master_dev, slaving_request_t *srqp
return ret;
}
static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *scp)
static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *scp)
{
equalizer_t *eql = dev->priv;
slave_t *slave;
......@@ -522,7 +516,7 @@ static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *scp)
return ret;
}
static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *scp)
static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *scp)
{
slave_t *slave;
equalizer_t *eql;
......@@ -553,7 +547,7 @@ static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *scp)
return ret;
}
static int eql_g_master_cfg(struct net_device *dev, master_config_t *mcp)
static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mcp)
{
equalizer_t *eql;
master_config_t mc;
......@@ -569,7 +563,7 @@ static int eql_g_master_cfg(struct net_device *dev, master_config_t *mcp)
return -EINVAL;
}
static int eql_s_master_cfg(struct net_device *dev, master_config_t *mcp)
static int eql_s_master_cfg(struct net_device *dev, master_config_t __user *mcp)
{
equalizer_t *eql;
master_config_t mc;
......
......@@ -1707,7 +1707,7 @@ static int ewrk3_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
struct ewrk3_ioctl *ioc = (struct ewrk3_ioctl *) &rq->ifr_data;
struct ewrk3_ioctl *ioc = (struct ewrk3_ioctl *) &rq->ifr_ifru;
u_long iobase = dev->base_addr;
int i, j, status = 0;
u_char csr;
......
......@@ -296,7 +296,7 @@
struct ewrk3_ioctl {
unsigned short cmd; /* Command to run */
unsigned short len; /* Length of the data buffer */
unsigned char *data; /* Pointer to the data buffer */
unsigned char __user *data; /* Pointer to the data buffer */
};
/*
......
......@@ -1947,7 +1947,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
rc = netdev_ethtool_ioctl(dev, rq->ifr_data);
else if (cmd == (SIOCDEVPRIVATE+3)) { /* set rx,tx intr params */
u32 *d = (u32 *)&rq->ifr_data;
u32 *d = (u32 *)&rq->ifr_ifru;
/* Should add this check here or an ordinary user can do nasty
* things. -KDU
*
......
......@@ -414,7 +414,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr,
{
struct baycom_state *bc;
struct baycom_ioctl bi;
int cmd2;
if (!dev || !dev->priv ||
((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) {
......@@ -425,8 +424,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr,
if (cmd != SIOCDEVPRIVATE)
return -ENOIOCTLCMD;
if (get_user(cmd2, (int *)ifr->ifr_data))
return -EFAULT;
switch (hi->cmd) {
default:
break;
......
......@@ -529,7 +529,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr,
{
struct baycom_state *bc;
struct baycom_ioctl bi;
int cmd2;
if (!dev || !dev->priv ||
((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) {
......@@ -540,8 +539,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr,
if (cmd != SIOCDEVPRIVATE)
return -ENOIOCTLCMD;
if (get_user(cmd2, (int *)ifr->ifr_data))
return -EFAULT;
switch (hi->cmd) {
default:
break;
......
......@@ -569,7 +569,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr,
{
struct baycom_state *bc;
struct baycom_ioctl bi;
int cmd2;
if (!dev || !dev->priv ||
((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) {
......@@ -580,8 +579,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr,
if (cmd != SIOCDEVPRIVATE)
return -ENOIOCTLCMD;
if (get_user(cmd2, (int *)ifr->ifr_data))
return -EFAULT;
switch (hi->cmd) {
default:
break;
......
......@@ -1556,7 +1556,7 @@ static struct ethtool_ops emac_ethtool_ops = {
static int emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct ocp_enet_private *fep = dev->priv;
uint *data = (uint *) & rq->ifr_data;
uint *data = (uint *) & rq->ifr_ifru;
switch (cmd) {
case SIOCGMIIPHY:
......
......@@ -1196,7 +1196,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct el3_private *lp = netdev_priv(dev);
ioaddr_t ioaddr = dev->base_addr;
u16 *data = (u16 *)&rq->ifr_data;
u16 *data = (u16 *)&rq->ifr_ifru;
int phy = lp->phys & 0x1f;
DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n",
......
......@@ -778,7 +778,7 @@ static struct ethtool_ops netdev_ethtool_ops = {
static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
axnet_dev_t *info = PRIV(dev);
u16 *data = (u16 *)&rq->ifr_data;
u16 *data = (u16 *)&rq->ifr_ifru;
ioaddr_t mii_addr = dev->base_addr + AXNET_MII_EEP;
switch (cmd) {
case SIOCGMIIPHY:
......
......@@ -1281,7 +1281,7 @@ static struct ethtool_ops netdev_ethtool_ops = {
static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
pcnet_dev_t *info = PRIV(dev);
u16 *data = (u16 *)&rq->ifr_data;
u16 *data = (u16 *)&rq->ifr_ifru;
ioaddr_t mii_addr = dev->base_addr + DLINK_GPIO;
switch (cmd) {
case SIOCGMIIPHY:
......
......@@ -1681,7 +1681,7 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
local_info_t *local = netdev_priv(dev);
ioaddr_t ioaddr = dev->base_addr;
u16 *data = (u16 *)&rq->ifr_data;
u16 *data = (u16 *)&rq->ifr_ifru;
DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n",
dev->name, rq->ifr_ifrn.ifrn_name, cmd,
......
......@@ -1217,7 +1217,7 @@ static int
plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct net_local *nl = netdev_priv(dev);
struct plipconf *pc = (struct plipconf *) &rq->ifr_data;
struct plipconf *pc = (struct plipconf *) &rq->ifr_ifru;
if (cmd != SIOCDEVPLIP)
return -EOPNOTSUPP;
......
......@@ -1031,14 +1031,14 @@ static int sb1000_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
case SIOCGCMFREQUENCY: /* get frequency */
if ((status = sb1000_get_frequency(ioaddr, name, &frequency)))
return status;
if(put_user(frequency, (int*) ifr->ifr_data))
if(put_user(frequency, (int __user *) ifr->ifr_data))
return -EFAULT;
break;
case SIOCSCMFREQUENCY: /* set frequency */
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if(get_user(frequency, (int*) ifr->ifr_data))
if(get_user(frequency, (int __user *) ifr->ifr_data))
return -EFAULT;
if ((status = sb1000_set_frequency(ioaddr, name, frequency)))
return status;
......
......@@ -2721,7 +2721,7 @@ static void sbmac_set_rx_mode(struct net_device *dev)
static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct sbmac_softc *sc = netdev_priv(dev);
u16 *data = (u16 *)&rq->ifr_data;
u16 *data = (u16 *)&rq->ifr_ifru;
unsigned long flags;
int retval;
......
......@@ -579,7 +579,7 @@ static int shaper_attach(struct net_device *shdev, struct shaper *sh, struct net
static int shaper_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_data;
struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_ifru;
struct shaper *sh=dev->priv;
if(ss->ss_cmd == SHAPER_SET_DEV || ss->ss_cmd == SHAPER_SET_SPEED)
......
......@@ -5535,7 +5535,7 @@ static int
de4x5_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct de4x5_private *lp = netdev_priv(dev);
struct de4x5_ioctl *ioc = (struct de4x5_ioctl *) &rq->ifr_data;
struct de4x5_ioctl *ioc = (struct de4x5_ioctl *) &rq->ifr_ifru;
u_long iobase = dev->base_addr;
int i, j, status = 0;
s32 omr;
......
......@@ -1471,7 +1471,7 @@ static int xircom_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
static int xircom_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct xircom_private *tp = dev->priv;
u16 *data = (u16 *)&rq->ifr_data;
u16 *data = (u16 *)&rq->ifr_ifru;
int phy = tp->phys[0] & 0x1f;
unsigned long flags;
......
......@@ -2542,7 +2542,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
pc300conf_t conf_aux;
pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
int ch = chan->channel;
void *arg = (void *) ifr->ifr_data;
void __user *arg = ifr->ifr_data;
struct if_settings *settings = &ifr->ifr_settings;
uclong scabase = card->hw.scabase;
......
......@@ -1342,7 +1342,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
return -EPERM;
spin_lock( &nl->lock );
flags = *(struct sbni_flags*) &ifr->ifr_data;
flags = *(struct sbni_flags*) &ifr->ifr_ifru;
if( flags.fixed_rxl )
nl->delta_rxl = 0,
nl->cur_rxl_index = flags.rxl;
......
......@@ -1030,7 +1030,7 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void __user *uaddr)
int cmd;
pegasus = net->priv;
if (get_user(cmd, (int *) uaddr))
if (get_user(cmd, (int __user *) uaddr))
return -EFAULT;
switch (cmd) {
case ETHTOOL_GDRVINFO:{
......@@ -1107,7 +1107,7 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void __user *uaddr)
#endif
static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
{
__u16 *data = (__u16 *) & rq->ifr_data;
__u16 *data = (__u16 *) & rq->ifr_ifru;
pegasus_t *pegasus = net->priv;
int res;
......
......@@ -856,7 +856,7 @@ static int rtl8150_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
int res;
dev = netdev->priv;
data = (u16 *) & rq->ifr_data;
data = (u16 *) & rq->ifr_ifru;
res = 0;
switch (cmd) {
......
......@@ -650,7 +650,7 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr)
int dev_ethtool(struct ifreq *ifr)
{
struct net_device *dev = __dev_get_by_name(ifr->ifr_name);
void __user *useraddr = (void __user *) ifr->ifr_data;
void __user *useraddr = ifr->ifr_data;
u32 ethcmd;
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment