From 64b0f9e29e5a4b02077d0d048865e7bd44036715 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Thu, 15 Apr 2004 23:56:23 -0700 Subject: [PATCH] [NET]: Add some sparse annotations to network driver stack. --- drivers/net/b44.c | 6 ++--- include/linux/divert.h | 4 ++-- include/linux/if.h | 2 +- include/linux/wireless.h | 2 +- net/core/dev.c | 10 ++++---- net/core/dv.c | 2 +- net/core/ethtool.c | 60 ++++++++++++++++++++++++------------------------ 7 files changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 5f5ffa68e40..01c18e5aa86 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -1382,7 +1382,7 @@ static void b44_set_rx_mode(struct net_device *dev) spin_unlock_irq(&bp->lock); } -static int b44_ethtool_ioctl (struct net_device *dev, void *useraddr) +static int b44_ethtool_ioctl (struct net_device *dev, void __user *useraddr) { struct b44 *bp = dev->priv; struct pci_dev *pci_dev = bp->pdev; @@ -1625,13 +1625,13 @@ static int b44_ethtool_ioctl (struct net_device *dev, void *useraddr) static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; + struct mii_ioctl_data __user *data = (struct mii_ioctl_data __user *)&ifr->ifr_data; struct b44 *bp = dev->priv; int err; switch (cmd) { case SIOCETHTOOL: - return b44_ethtool_ioctl(dev, (void *) ifr->ifr_data); + return b44_ethtool_ioctl(dev, (void __user*) ifr->ifr_data); case SIOCGMIIPHY: data->phy_id = bp->phy_addr; diff --git a/include/linux/divert.h b/include/linux/divert.h index 38497a64365..e11c909eb7f 100644 --- a/include/linux/divert.h +++ b/include/linux/divert.h @@ -46,7 +46,7 @@ typedef union _divert_cf_arg u32 uint32; s64 int64; u64 uint64; - void *ptr; + void __user *ptr; } divert_cf_arg; @@ -111,7 +111,7 @@ struct divert_cf #ifdef CONFIG_NET_DIVERT int alloc_divert_blk(struct net_device *); void free_divert_blk(struct net_device *); -int divert_ioctl(unsigned int cmd, struct divert_cf *arg); +int divert_ioctl(unsigned int cmd, struct divert_cf __user *arg); void divert_frame(struct sk_buff *skb); static inline void handle_diverter(struct sk_buff *skb) { diff --git a/include/linux/if.h b/include/linux/if.h index a9fdca178d2..0a3fdd8cab1 100644 --- a/include/linux/if.h +++ b/include/linux/if.h @@ -144,7 +144,7 @@ struct ifreq struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_newname[IFNAMSIZ]; - char * ifru_data; + char __user * ifru_data; struct if_settings ifru_settings; } ifr_ifru; }; diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 965a83b1c31..8022bf19a95 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h @@ -438,7 +438,7 @@ struct iw_param */ struct iw_point { - caddr_t pointer; /* Pointer to the data (in user space) */ + void __user *pointer; /* Pointer to the data (in user space) */ __u16 length; /* number of fields or size in bytes */ __u16 flags; /* Optional params */ }; diff --git a/net/core/dev.c b/net/core/dev.c index ff9defc681d..ef7eb00b09d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1903,7 +1903,7 @@ int register_gifconf(unsigned int family, gifconf_func_t * gifconf) * match. --pb */ -static int dev_ifname(struct ifreq *arg) +static int dev_ifname(struct ifreq __user *arg) { struct net_device *dev; struct ifreq ifr; @@ -1936,7 +1936,7 @@ static int dev_ifname(struct ifreq *arg) * Thus we will need a 'compatibility mode'. */ -static int dev_ifconf(char *arg) +static int dev_ifconf(char __user *arg) { struct ifconf ifc; struct net_device *dev; @@ -2539,7 +2539,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd) * positive or a negative errno code on error. */ -int dev_ioctl(unsigned int cmd, void *arg) +int dev_ioctl(unsigned int cmd, void __user *arg) { struct ifreq ifr; int ret; @@ -2552,12 +2552,12 @@ int dev_ioctl(unsigned int cmd, void *arg) if (cmd == SIOCGIFCONF) { rtnl_shlock(); - ret = dev_ifconf((char *) arg); + ret = dev_ifconf((char __user *) arg); rtnl_shunlock(); return ret; } if (cmd == SIOCGIFNAME) - return dev_ifname((struct ifreq *)arg); + return dev_ifname((struct ifreq __user *)arg); if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) return -EFAULT; diff --git a/net/core/dv.c b/net/core/dv.c index 999eac94d5c..c1340cc53b7 100644 --- a/net/core/dv.c +++ b/net/core/dv.c @@ -195,7 +195,7 @@ out: #define DVDBG(a) \ printk(KERN_DEBUG "divert_ioctl() line %d %s\n", __LINE__, (a)) -int divert_ioctl(unsigned int cmd, struct divert_cf *arg) +int divert_ioctl(unsigned int cmd, struct divert_cf __user *arg) { struct divert_cf div_cf; struct divert_blk *div_blk; diff --git a/net/core/ethtool.c b/net/core/ethtool.c index c0d4c385cfc..04608e88863 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -74,7 +74,7 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data) /* Handlers for each ethtool command */ -static int ethtool_get_settings(struct net_device *dev, void *useraddr) +static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) { struct ethtool_cmd cmd = { ETHTOOL_GSET }; int err; @@ -91,7 +91,7 @@ static int ethtool_get_settings(struct net_device *dev, void *useraddr) return 0; } -static int ethtool_set_settings(struct net_device *dev, void *useraddr) +static int ethtool_set_settings(struct net_device *dev, void __user *useraddr) { struct ethtool_cmd cmd; @@ -104,7 +104,7 @@ static int ethtool_set_settings(struct net_device *dev, void *useraddr) return dev->ethtool_ops->set_settings(dev, &cmd); } -static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr) +static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr) { struct ethtool_drvinfo info; struct ethtool_ops *ops = dev->ethtool_ops; @@ -130,7 +130,7 @@ static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr) return 0; } -static int ethtool_get_regs(struct net_device *dev, char *useraddr) +static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) { struct ethtool_regs regs; struct ethtool_ops *ops = dev->ethtool_ops; @@ -166,7 +166,7 @@ static int ethtool_get_regs(struct net_device *dev, char *useraddr) return ret; } -static int ethtool_get_wol(struct net_device *dev, char *useraddr) +static int ethtool_get_wol(struct net_device *dev, char __user *useraddr) { struct ethtool_wolinfo wol = { ETHTOOL_GWOL }; @@ -180,7 +180,7 @@ static int ethtool_get_wol(struct net_device *dev, char *useraddr) return 0; } -static int ethtool_set_wol(struct net_device *dev, char *useraddr) +static int ethtool_set_wol(struct net_device *dev, char __user *useraddr) { struct ethtool_wolinfo wol; @@ -193,7 +193,7 @@ static int ethtool_set_wol(struct net_device *dev, char *useraddr) return dev->ethtool_ops->set_wol(dev, &wol); } -static int ethtool_get_msglevel(struct net_device *dev, char *useraddr) +static int ethtool_get_msglevel(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata = { ETHTOOL_GMSGLVL }; @@ -207,7 +207,7 @@ static int ethtool_get_msglevel(struct net_device *dev, char *useraddr) return 0; } -static int ethtool_set_msglevel(struct net_device *dev, char *useraddr) +static int ethtool_set_msglevel(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata; @@ -229,7 +229,7 @@ static int ethtool_nway_reset(struct net_device *dev) return dev->ethtool_ops->nway_reset(dev); } -static int ethtool_get_link(struct net_device *dev, void *useraddr) +static int ethtool_get_link(struct net_device *dev, void __user *useraddr) { struct ethtool_value edata = { ETHTOOL_GLINK }; @@ -243,7 +243,7 @@ static int ethtool_get_link(struct net_device *dev, void *useraddr) return 0; } -static int ethtool_get_eeprom(struct net_device *dev, void *useraddr) +static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) { struct ethtool_eeprom eeprom; struct ethtool_ops *ops = dev->ethtool_ops; @@ -288,7 +288,7 @@ static int ethtool_get_eeprom(struct net_device *dev, void *useraddr) return ret; } -static int ethtool_set_eeprom(struct net_device *dev, void *useraddr) +static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr) { struct ethtool_eeprom eeprom; struct ethtool_ops *ops = dev->ethtool_ops; @@ -329,7 +329,7 @@ static int ethtool_set_eeprom(struct net_device *dev, void *useraddr) return ret; } -static int ethtool_get_coalesce(struct net_device *dev, void *useraddr) +static int ethtool_get_coalesce(struct net_device *dev, void __user *useraddr) { struct ethtool_coalesce coalesce = { ETHTOOL_GCOALESCE }; @@ -343,7 +343,7 @@ static int ethtool_get_coalesce(struct net_device *dev, void *useraddr) return 0; } -static int ethtool_set_coalesce(struct net_device *dev, void *useraddr) +static int ethtool_set_coalesce(struct net_device *dev, void __user *useraddr) { struct ethtool_coalesce coalesce; @@ -356,7 +356,7 @@ static int ethtool_set_coalesce(struct net_device *dev, void *useraddr) return dev->ethtool_ops->set_coalesce(dev, &coalesce); } -static int ethtool_get_ringparam(struct net_device *dev, void *useraddr) +static int ethtool_get_ringparam(struct net_device *dev, void __user *useraddr) { struct ethtool_ringparam ringparam = { ETHTOOL_GRINGPARAM }; @@ -370,7 +370,7 @@ static int ethtool_get_ringparam(struct net_device *dev, void *useraddr) return 0; } -static int ethtool_set_ringparam(struct net_device *dev, void *useraddr) +static int ethtool_set_ringparam(struct net_device *dev, void __user *useraddr) { struct ethtool_ringparam ringparam; @@ -383,7 +383,7 @@ static int ethtool_set_ringparam(struct net_device *dev, void *useraddr) return dev->ethtool_ops->set_ringparam(dev, &ringparam); } -static int ethtool_get_pauseparam(struct net_device *dev, void *useraddr) +static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr) { struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM }; @@ -397,7 +397,7 @@ static int ethtool_get_pauseparam(struct net_device *dev, void *useraddr) return 0; } -static int ethtool_set_pauseparam(struct net_device *dev, void *useraddr) +static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr) { struct ethtool_pauseparam pauseparam; @@ -410,7 +410,7 @@ static int ethtool_set_pauseparam(struct net_device *dev, void *useraddr) return dev->ethtool_ops->set_pauseparam(dev, &pauseparam); } -static int ethtool_get_rx_csum(struct net_device *dev, char *useraddr) +static int ethtool_get_rx_csum(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata = { ETHTOOL_GRXCSUM }; @@ -424,7 +424,7 @@ static int ethtool_get_rx_csum(struct net_device *dev, char *useraddr) return 0; } -static int ethtool_set_rx_csum(struct net_device *dev, char *useraddr) +static int ethtool_set_rx_csum(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata; @@ -438,7 +438,7 @@ static int ethtool_set_rx_csum(struct net_device *dev, char *useraddr) return 0; } -static int ethtool_get_tx_csum(struct net_device *dev, char *useraddr) +static int ethtool_get_tx_csum(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata = { ETHTOOL_GTXCSUM }; @@ -452,7 +452,7 @@ static int ethtool_get_tx_csum(struct net_device *dev, char *useraddr) return 0; } -static int ethtool_set_tx_csum(struct net_device *dev, char *useraddr) +static int ethtool_set_tx_csum(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata; @@ -465,7 +465,7 @@ static int ethtool_set_tx_csum(struct net_device *dev, char *useraddr) return dev->ethtool_ops->set_tx_csum(dev, edata.data); } -static int ethtool_get_sg(struct net_device *dev, char *useraddr) +static int ethtool_get_sg(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata = { ETHTOOL_GSG }; @@ -479,7 +479,7 @@ static int ethtool_get_sg(struct net_device *dev, char *useraddr) return 0; } -static int ethtool_set_sg(struct net_device *dev, char *useraddr) +static int ethtool_set_sg(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata; @@ -492,7 +492,7 @@ static int ethtool_set_sg(struct net_device *dev, char *useraddr) return dev->ethtool_ops->set_sg(dev, edata.data); } -static int ethtool_get_tso(struct net_device *dev, char *useraddr) +static int ethtool_get_tso(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata = { ETHTOOL_GTSO }; @@ -506,7 +506,7 @@ static int ethtool_get_tso(struct net_device *dev, char *useraddr) return 0; } -static int ethtool_set_tso(struct net_device *dev, char *useraddr) +static int ethtool_set_tso(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata; @@ -519,7 +519,7 @@ static int ethtool_set_tso(struct net_device *dev, char *useraddr) return dev->ethtool_ops->set_tso(dev, edata.data); } -static int ethtool_self_test(struct net_device *dev, char *useraddr) +static int ethtool_self_test(struct net_device *dev, char __user *useraddr) { struct ethtool_test test; struct ethtool_ops *ops = dev->ethtool_ops; @@ -552,7 +552,7 @@ static int ethtool_self_test(struct net_device *dev, char *useraddr) return ret; } -static int ethtool_get_strings(struct net_device *dev, void *useraddr) +static int ethtool_get_strings(struct net_device *dev, void __user *useraddr) { struct ethtool_gstrings gstrings; struct ethtool_ops *ops = dev->ethtool_ops; @@ -599,7 +599,7 @@ static int ethtool_get_strings(struct net_device *dev, void *useraddr) return ret; } -static int ethtool_phys_id(struct net_device *dev, void *useraddr) +static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) { struct ethtool_value id; @@ -612,7 +612,7 @@ static int ethtool_phys_id(struct net_device *dev, void *useraddr) return dev->ethtool_ops->phys_id(dev, id.data); } -static int ethtool_get_stats(struct net_device *dev, void *useraddr) +static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) { struct ethtool_stats stats; struct ethtool_ops *ops = dev->ethtool_ops; @@ -650,7 +650,7 @@ static int ethtool_get_stats(struct net_device *dev, void *useraddr) int dev_ethtool(struct ifreq *ifr) { struct net_device *dev = __dev_get_by_name(ifr->ifr_name); - void *useraddr = (void *) ifr->ifr_data; + void __user *useraddr = (void __user *) ifr->ifr_data; u32 ethcmd; /* -- 2.11.4.GIT