Commit babae77f authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: trivial part of net/* annotation

parent b623544c
...@@ -96,7 +96,7 @@ extern int unregister_inetaddr_notifier(struct notifier_block *nb); ...@@ -96,7 +96,7 @@ extern int unregister_inetaddr_notifier(struct notifier_block *nb);
extern struct net_device *ip_dev_find(u32 addr); extern struct net_device *ip_dev_find(u32 addr);
extern int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b); extern int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b);
extern int devinet_ioctl(unsigned int cmd, void *); extern int devinet_ioctl(unsigned int cmd, void __user *);
extern void devinet_init(void); extern void devinet_init(void);
extern struct in_device *inetdev_init(struct net_device *dev); extern struct in_device *inetdev_init(struct net_device *dev);
extern struct in_device *inetdev_by_index(int); extern struct in_device *inetdev_by_index(int);
......
...@@ -52,9 +52,9 @@ struct prefix_info { ...@@ -52,9 +52,9 @@ struct prefix_info {
extern void addrconf_init(void); extern void addrconf_init(void);
extern void addrconf_cleanup(void); extern void addrconf_cleanup(void);
extern int addrconf_add_ifaddr(void *arg); extern int addrconf_add_ifaddr(void __user *arg);
extern int addrconf_del_ifaddr(void *arg); extern int addrconf_del_ifaddr(void __user *arg);
extern int addrconf_set_dstaddr(void *arg); extern int addrconf_set_dstaddr(void __user *arg);
extern int ipv6_chk_addr(struct in6_addr *addr, extern int ipv6_chk_addr(struct in6_addr *addr,
struct net_device *dev, struct net_device *dev,
......
...@@ -13,7 +13,7 @@ extern void arp_init(void); ...@@ -13,7 +13,7 @@ extern void arp_init(void);
extern int arp_rcv(struct sk_buff *skb, struct net_device *dev, extern int arp_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt); struct packet_type *pt);
extern int arp_find(unsigned char *haddr, struct sk_buff *skb); extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
extern int arp_ioctl(unsigned int cmd, void *arg); extern int arp_ioctl(unsigned int cmd, void __user *arg);
extern void arp_send(int type, int ptype, u32 dest_ip, extern void arp_send(int type, int ptype, u32 dest_ip,
struct net_device *dev, u32 src_ip, struct net_device *dev, u32 src_ip,
unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
......
...@@ -29,9 +29,9 @@ struct compat_cmsghdr { ...@@ -29,9 +29,9 @@ struct compat_cmsghdr {
extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
extern int verify_compat_iovec(struct msghdr *, struct iovec *, char *, int); extern int verify_compat_iovec(struct msghdr *, struct iovec *, char *, int);
extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr *,unsigned); extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr *,unsigned); extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
extern asmlinkage long compat_sys_getsockopt(int, int, int, char *, int *); extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *, extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *,
int); int);
......
...@@ -300,11 +300,11 @@ extern int ipv4_proc_init(void); ...@@ -300,11 +300,11 @@ extern int ipv4_proc_init(void);
* fed into the routing cache should use these handlers. * fed into the routing cache should use these handlers.
*/ */
int ipv4_doint_and_flush(ctl_table *ctl, int write, int ipv4_doint_and_flush(ctl_table *ctl, int write,
struct file* filp, void *buffer, struct file* filp, void __user *buffer,
size_t *lenp); size_t *lenp);
int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen, int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen, void __user *newval, size_t newlen,
void **context); void **context);
#endif /* _IP_H */ #endif /* _IP_H */
...@@ -35,7 +35,7 @@ extern int ip6_route_me_harder(struct sk_buff *skb); ...@@ -35,7 +35,7 @@ extern int ip6_route_me_harder(struct sk_buff *skb);
extern void ip6_route_init(void); extern void ip6_route_init(void);
extern void ip6_route_cleanup(void); extern void ip6_route_cleanup(void);
extern int ipv6_route_ioctl(unsigned int cmd, void *arg); extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg);
extern int ip6_route_add(struct in6_rtmsg *rtmsg, extern int ip6_route_add(struct in6_rtmsg *rtmsg,
struct nlmsghdr *, struct nlmsghdr *,
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <net/compat.h> #include <net/compat.h>
static inline int iov_from_user_compat_to_kern(struct iovec *kiov, static inline int iov_from_user_compat_to_kern(struct iovec *kiov,
struct compat_iovec *uiov32, struct compat_iovec __user *uiov32,
int niov) int niov)
{ {
int tot_len = 0; int tot_len = 0;
...@@ -53,7 +53,7 @@ static inline int iov_from_user_compat_to_kern(struct iovec *kiov, ...@@ -53,7 +53,7 @@ static inline int iov_from_user_compat_to_kern(struct iovec *kiov,
return tot_len; return tot_len;
} }
int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr *umsg) int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg)
{ {
compat_uptr_t tmp1, tmp2, tmp3; compat_uptr_t tmp1, tmp2, tmp3;
...@@ -98,7 +98,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov, ...@@ -98,7 +98,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
} }
tot_len = iov_from_user_compat_to_kern(kern_iov, tot_len = iov_from_user_compat_to_kern(kern_iov,
(struct compat_iovec *)kern_msg->msg_iov, (struct compat_iovec __user *)kern_msg->msg_iov,
kern_msg->msg_iovlen); kern_msg->msg_iovlen);
if(tot_len >= 0) if(tot_len >= 0)
kern_msg->msg_iov = kern_iov; kern_msg->msg_iov = kern_iov;
...@@ -112,7 +112,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov, ...@@ -112,7 +112,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
#define CMSG_COMPAT_ALIGN(len) ALIGN((len), sizeof(s32)) #define CMSG_COMPAT_ALIGN(len) ALIGN((len), sizeof(s32))
#define CMSG_COMPAT_DATA(cmsg) \ #define CMSG_COMPAT_DATA(cmsg) \
((void *)((char *)(cmsg) + CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)))) ((void __user *)((char __user *)(cmsg) + CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr))))
#define CMSG_COMPAT_SPACE(len) \ #define CMSG_COMPAT_SPACE(len) \
(CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)) + CMSG_COMPAT_ALIGN(len)) (CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)) + CMSG_COMPAT_ALIGN(len))
#define CMSG_COMPAT_LEN(len) \ #define CMSG_COMPAT_LEN(len) \
...@@ -120,20 +120,17 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov, ...@@ -120,20 +120,17 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
#define CMSG_COMPAT_FIRSTHDR(msg) \ #define CMSG_COMPAT_FIRSTHDR(msg) \
(((msg)->msg_controllen) >= sizeof(struct compat_cmsghdr) ? \ (((msg)->msg_controllen) >= sizeof(struct compat_cmsghdr) ? \
(struct compat_cmsghdr *)((msg)->msg_control) : \ (struct compat_cmsghdr __user *)((msg)->msg_control) : \
(struct compat_cmsghdr *)NULL) (struct compat_cmsghdr __user *)NULL)
static inline struct compat_cmsghdr *cmsg_compat_nxthdr(struct msghdr *msg, static inline struct compat_cmsghdr __user *cmsg_compat_nxthdr(struct msghdr *msg,
struct compat_cmsghdr *cmsg, int cmsg_len) struct compat_cmsghdr __user *cmsg, int cmsg_len)
{ {
struct compat_cmsghdr *ptr; char __user *ptr = (char __user *)cmsg + CMSG_COMPAT_ALIGN(cmsg_len);
if ((unsigned long)(ptr + 1 - (char __user *)msg->msg_control) >
ptr = (struct compat_cmsghdr *)(((unsigned char *)cmsg) +
CMSG_COMPAT_ALIGN(cmsg_len));
if ((unsigned long)((char *)(ptr + 1) - (char *)msg->msg_control) >
msg->msg_controllen) msg->msg_controllen)
return NULL; return NULL;
return ptr; return (struct compat_cmsghdr __user *)ptr;
} }
/* There is a lot of hair here because the alignment rules (and /* There is a lot of hair here because the alignment rules (and
...@@ -143,7 +140,7 @@ static inline struct compat_cmsghdr *cmsg_compat_nxthdr(struct msghdr *msg, ...@@ -143,7 +140,7 @@ static inline struct compat_cmsghdr *cmsg_compat_nxthdr(struct msghdr *msg,
int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
unsigned char *stackbuf, int stackbuf_size) unsigned char *stackbuf, int stackbuf_size)
{ {
struct compat_cmsghdr *ucmsg; struct compat_cmsghdr __user *ucmsg;
struct cmsghdr *kcmsg, *kcmsg_base; struct cmsghdr *kcmsg, *kcmsg_base;
compat_size_t ucmlen; compat_size_t ucmlen;
__kernel_size_t kcmlen, tmp; __kernel_size_t kcmlen, tmp;
...@@ -159,7 +156,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, ...@@ -159,7 +156,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
if(CMSG_COMPAT_ALIGN(ucmlen) < if(CMSG_COMPAT_ALIGN(ucmlen) <
CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr))) CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)))
return -EINVAL; return -EINVAL;
if((unsigned long)(((char *)ucmsg - (char *)kmsg->msg_control) if((unsigned long)(((char __user *)ucmsg - (char __user *)kmsg->msg_control)
+ ucmlen) > kmsg->msg_controllen) + ucmlen) > kmsg->msg_controllen)
return -EINVAL; return -EINVAL;
...@@ -217,7 +214,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, ...@@ -217,7 +214,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data) int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
{ {
struct compat_timeval ctv; struct compat_timeval ctv;
struct compat_cmsghdr *cm = (struct compat_cmsghdr *) kmsg->msg_control; struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
struct compat_cmsghdr cmhdr; struct compat_cmsghdr cmhdr;
int cmlen; int cmlen;
...@@ -255,17 +252,17 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat ...@@ -255,17 +252,17 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm) void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm)
{ {
struct compat_cmsghdr *cm = (struct compat_cmsghdr *) kmsg->msg_control; struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
int fdmax = (kmsg->msg_controllen - sizeof(struct compat_cmsghdr)) / sizeof(int); int fdmax = (kmsg->msg_controllen - sizeof(struct compat_cmsghdr)) / sizeof(int);
int fdnum = scm->fp->count; int fdnum = scm->fp->count;
struct file **fp = scm->fp->fp; struct file **fp = scm->fp->fp;
int *cmfptr; int __user *cmfptr;
int err = 0, i; int err = 0, i;
if (fdnum < fdmax) if (fdnum < fdmax)
fdmax = fdnum; fdmax = fdnum;
for (i = 0, cmfptr = (int *) CMSG_COMPAT_DATA(cm); i < fdmax; i++, cmfptr++) { for (i = 0, cmfptr = (int __user *) CMSG_COMPAT_DATA(cm); i < fdmax; i++, cmfptr++) {
int new_fd; int new_fd;
err = get_unused_fd(); err = get_unused_fd();
if (err < 0) if (err < 0)
...@@ -322,10 +319,10 @@ struct compat_ipt_replace { ...@@ -322,10 +319,10 @@ struct compat_ipt_replace {
}; };
static int do_netfilter_replace(int fd, int level, int optname, static int do_netfilter_replace(int fd, int level, int optname,
char *optval, int optlen) char __user *optval, int optlen)
{ {
struct compat_ipt_replace *urepl = (struct compat_ipt_replace *)optval; struct compat_ipt_replace __user *urepl;
struct ipt_replace *repl_nat; struct ipt_replace __user *repl_nat;
char name[IPT_TABLE_MAXNAMELEN]; char name[IPT_TABLE_MAXNAMELEN];
u32 origsize, tmp32, num_counters; u32 origsize, tmp32, num_counters;
unsigned int repl_nat_size; unsigned int repl_nat_size;
...@@ -333,6 +330,7 @@ static int do_netfilter_replace(int fd, int level, int optname, ...@@ -333,6 +330,7 @@ static int do_netfilter_replace(int fd, int level, int optname,
int i; int i;
compat_uptr_t ucntrs; compat_uptr_t ucntrs;
urepl = (struct compat_ipt_replace __user *)optval;
if (get_user(origsize, &urepl->size)) if (get_user(origsize, &urepl->size))
return -EFAULT; return -EFAULT;
...@@ -399,7 +397,7 @@ static int do_netfilter_replace(int fd, int level, int optname, ...@@ -399,7 +397,7 @@ static int do_netfilter_replace(int fd, int level, int optname,
ret = sys_setsockopt(fd, level, optname, ret = sys_setsockopt(fd, level, optname,
(char *)repl_nat, repl_nat_size); (char __user *)repl_nat, repl_nat_size);
out: out:
return ret; return ret;
...@@ -414,10 +412,10 @@ struct compat_sock_fprog { ...@@ -414,10 +412,10 @@ struct compat_sock_fprog {
}; };
static int do_set_attach_filter(int fd, int level, int optname, static int do_set_attach_filter(int fd, int level, int optname,
char *optval, int optlen) char __user *optval, int optlen)
{ {
struct compat_sock_fprog *fprog32 = (struct compat_sock_fprog *)optval; struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
struct sock_fprog *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog));
compat_uptr_t ptr; compat_uptr_t ptr;
u16 len; u16 len;
...@@ -429,13 +427,13 @@ static int do_set_attach_filter(int fd, int level, int optname, ...@@ -429,13 +427,13 @@ static int do_set_attach_filter(int fd, int level, int optname,
__put_user(compat_ptr(ptr), &kfprog->filter)) __put_user(compat_ptr(ptr), &kfprog->filter))
return -EFAULT; return -EFAULT;
return sys_setsockopt(fd, level, optname, (char *)kfprog, return sys_setsockopt(fd, level, optname, (char __user *)kfprog,
sizeof(struct sock_fprog)); sizeof(struct sock_fprog));
} }
static int do_set_sock_timeout(int fd, int level, int optname, char *optval, int optlen) static int do_set_sock_timeout(int fd, int level, int optname, char __user *optval, int optlen)
{ {
struct compat_timeval *up = (struct compat_timeval *) optval; struct compat_timeval __user *up = (struct compat_timeval __user *) optval;
struct timeval ktime; struct timeval ktime;
mm_segment_t old_fs; mm_segment_t old_fs;
int err; int err;
...@@ -455,7 +453,7 @@ static int do_set_sock_timeout(int fd, int level, int optname, char *optval, int ...@@ -455,7 +453,7 @@ static int do_set_sock_timeout(int fd, int level, int optname, char *optval, int
} }
asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
char *optval, int optlen) char __user *optval, int optlen)
{ {
if (optname == IPT_SO_SET_REPLACE) if (optname == IPT_SO_SET_REPLACE)
return do_netfilter_replace(fd, level, optname, return do_netfilter_replace(fd, level, optname,
...@@ -469,14 +467,15 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, ...@@ -469,14 +467,15 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
return sys_setsockopt(fd, level, optname, optval, optlen); return sys_setsockopt(fd, level, optname, optval, optlen);
} }
static int do_get_sock_timeout(int fd, int level, int optname, char *optval, static int do_get_sock_timeout(int fd, int level, int optname,
int *optlen) char __user *optval, int __user *optlen)
{ {
struct compat_timeval *up = (struct compat_timeval *) optval; struct compat_timeval __user *up;
struct timeval ktime; struct timeval ktime;
mm_segment_t old_fs; mm_segment_t old_fs;
int len, err; int len, err;
up = (struct compat_timeval __user *) optval;
if (get_user(len, optlen)) if (get_user(len, optlen))
return -EFAULT; return -EFAULT;
if (len < sizeof(*up)) if (len < sizeof(*up))
...@@ -498,7 +497,7 @@ static int do_get_sock_timeout(int fd, int level, int optname, char *optval, ...@@ -498,7 +497,7 @@ static int do_get_sock_timeout(int fd, int level, int optname, char *optval,
} }
asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
char *optval, int *optlen) char __user *optval, int __user *optlen)
{ {
if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO) if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)
return do_get_sock_timeout(fd, level, optname, optval, optlen); return do_get_sock_timeout(fd, level, optname, optval, optlen);
...@@ -512,17 +511,17 @@ static unsigned char nas[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), ...@@ -512,17 +511,17 @@ static unsigned char nas[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)}; AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)};
#undef AL #undef AL
asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr *msg, unsigned flags) asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags)
{ {
return sys_sendmsg(fd, (struct msghdr *)msg, flags | MSG_CMSG_COMPAT); return sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
} }
asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr *msg, unsigned int flags) asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags)
{ {
return sys_recvmsg(fd, (struct msghdr *)msg, flags | MSG_CMSG_COMPAT); return sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
} }
asmlinkage long compat_sys_socketcall(int call, u32 *args) asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
{ {
int ret; int ret;
u32 a[6]; u32 a[6];
......
...@@ -853,7 +853,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -853,7 +853,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCDARP: case SIOCDARP:
case SIOCGARP: case SIOCGARP:
case SIOCSARP: case SIOCSARP:
err = arp_ioctl(cmd, (void *)arg); err = arp_ioctl(cmd, (void __user *)arg);
break; break;
case SIOCGIFADDR: case SIOCGIFADDR:
case SIOCSIFADDR: case SIOCSIFADDR:
...@@ -866,7 +866,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -866,7 +866,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCSIFPFLAGS: case SIOCSIFPFLAGS:
case SIOCGIFPFLAGS: case SIOCGIFPFLAGS:
case SIOCSIFFLAGS: case SIOCSIFFLAGS:
err = devinet_ioctl(cmd, (void *)arg); err = devinet_ioctl(cmd, (void __user *)arg);
break; break;
default: default:
if (!sk->sk_prot->ioctl || if (!sk->sk_prot->ioctl ||
......
...@@ -1103,7 +1103,7 @@ int arp_req_delete(struct arpreq *r, struct net_device * dev) ...@@ -1103,7 +1103,7 @@ int arp_req_delete(struct arpreq *r, struct net_device * dev)
* Handle an ARP layer I/O control request. * Handle an ARP layer I/O control request.
*/ */
int arp_ioctl(unsigned int cmd, void *arg) int arp_ioctl(unsigned int cmd, void __user *arg)
{ {
int err; int err;
struct arpreq r; struct arpreq r;
......
...@@ -489,7 +489,7 @@ static __inline__ int inet_abc_len(u32 addr) ...@@ -489,7 +489,7 @@ static __inline__ int inet_abc_len(u32 addr)
} }
int devinet_ioctl(unsigned int cmd, void *arg) int devinet_ioctl(unsigned int cmd, void __user *arg)
{ {
struct ifreq ifr; struct ifreq ifr;
struct sockaddr_in sin_orig; struct sockaddr_in sin_orig;
...@@ -713,7 +713,7 @@ int devinet_ioctl(unsigned int cmd, void *arg) ...@@ -713,7 +713,7 @@ int devinet_ioctl(unsigned int cmd, void *arg)
goto out; goto out;
} }
static int inet_gifconf(struct net_device *dev, char *buf, int len) static int inet_gifconf(struct net_device *dev, char __user *buf, int len)
{ {
struct in_device *in_dev = __in_dev_get(dev); struct in_device *in_dev = __in_dev_get(dev);
struct in_ifaddr *ifa; struct in_ifaddr *ifa;
...@@ -1136,7 +1136,7 @@ void inet_forward_change(void) ...@@ -1136,7 +1136,7 @@ void inet_forward_change(void)
} }
static int devinet_sysctl_forward(ctl_table *ctl, int write, static int devinet_sysctl_forward(ctl_table *ctl, int write,
struct file* filp, void *buffer, struct file* filp, void __user *buffer,
size_t *lenp) size_t *lenp)
{ {
int *valp = ctl->data; int *valp = ctl->data;
...@@ -1154,7 +1154,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, ...@@ -1154,7 +1154,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
} }
int ipv4_doint_and_flush(ctl_table *ctl, int write, int ipv4_doint_and_flush(ctl_table *ctl, int write,
struct file* filp, void *buffer, struct file* filp, void __user *buffer,
size_t *lenp) size_t *lenp)
{ {
int *valp = ctl->data; int *valp = ctl->data;
...@@ -1167,9 +1167,9 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write, ...@@ -1167,9 +1167,9 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write,
return ret; return ret;
} }
int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen, int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen, void __user *newval, size_t newlen,
void **context) void **context)
{ {
int *valp = table->data; int *valp = table->data;
...@@ -1181,7 +1181,7 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen, ...@@ -1181,7 +1181,7 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen,
if (newlen != sizeof(int)) if (newlen != sizeof(int))
return -EINVAL; return -EINVAL;
if (get_user(new, (int *)newval)) if (get_user(new, (int __user *)newval))
return -EFAULT; return -EFAULT;
if (new == *valp) if (new == *valp)
......
...@@ -631,7 +631,7 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -631,7 +631,7 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
switch (cmd) { switch (cmd) {
case SIOCOUTQ: { case SIOCOUTQ: {
int amount = atomic_read(&sk->sk_wmem_alloc); int amount = atomic_read(&sk->sk_wmem_alloc);
return put_user(amount, (int *)arg); return put_user(amount, (int __user *)arg);
} }
case SIOCINQ: { case SIOCINQ: {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -642,7 +642,7 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -642,7 +642,7 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
if (skb != NULL) if (skb != NULL)
amount = skb->len; amount = skb->len;
spin_unlock_irq(&sk->sk_receive_queue.lock); spin_unlock_irq(&sk->sk_receive_queue.lock);
return put_user(amount, (int *)arg); return put_user(amount, (int __user *)arg);
} }
default: default:
......
...@@ -2482,7 +2482,7 @@ void ip_rt_multicast_event(struct in_device *in_dev) ...@@ -2482,7 +2482,7 @@ void ip_rt_multicast_event(struct in_device *in_dev)
static int flush_delay; static int flush_delay;
static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write, static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
struct file *filp, void *buffer, struct file *filp, void __user *buffer,
size_t *lenp) size_t *lenp)
{ {
if (write) { if (write) {
...@@ -2494,15 +2494,19 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write, ...@@ -2494,15 +2494,19 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
return -EINVAL; return -EINVAL;
} }
static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, int *name, static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
int nlen, void *oldval, int __user *name,
size_t *oldlenp, void *newval, int nlen,
size_t newlen, void **context) void __user *oldval,
size_t __user *oldlenp,
void __user *newval,
size_t newlen,
void **context)
{ {
int delay; int delay;
if (newlen != sizeof(int)) if (newlen != sizeof(int))
return -EINVAL; return -EINVAL;
if (get_user(delay, (int *)newval)) if (get_user(delay, (int __user *)newval))
return -EFAULT; return -EFAULT;
rt_cache_flush(delay); rt_cache_flush(delay);
return 0; return 0;
......
...@@ -62,7 +62,7 @@ extern ctl_table ipv4_route_table[]; ...@@ -62,7 +62,7 @@ extern ctl_table ipv4_route_table[];
static static
int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp, int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
int val = ipv4_devconf.forwarding; int val = ipv4_devconf.forwarding;
int ret; int ret;
...@@ -75,9 +75,10 @@ int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp, ...@@ -75,9 +75,10 @@ int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
return ret; return ret;
} }
static int ipv4_sysctl_forward_strategy(ctl_table *table, int *name, int nlen, static int ipv4_sysctl_forward_strategy(ctl_table *table,
void *oldval, size_t *oldlenp, int __user *name, int nlen,
void *newval, size_t newlen, void __user *oldval, size_t __user *oldlenp,
void __user *newval, size_t newlen,
void **context) void **context)
{ {
int *valp = table->data; int *valp = table->data;
...@@ -89,7 +90,7 @@ static int ipv4_sysctl_forward_strategy(ctl_table *table, int *name, int nlen, ...@@ -89,7 +90,7 @@ static int ipv4_sysctl_forward_strategy(ctl_table *table, int *name, int nlen,
if (newlen != sizeof(int)) if (newlen != sizeof(int))
return -EINVAL; return -EINVAL;
if (get_user(new, (int *)newval)) if (get_user(new, (int __user *)newval))
return -EFAULT; return -EFAULT;
if (new == *valp) if (new == *valp)
......
...@@ -530,7 +530,7 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -530,7 +530,7 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
}; };
return put_user(answ, (int *)arg); return put_user(answ, (int __user *)arg);
} }
......
...@@ -725,7 +725,7 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -725,7 +725,7 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
case SIOCOUTQ: case SIOCOUTQ:
{ {
int amount = atomic_read(&sk->sk_wmem_alloc); int amount = atomic_read(&sk->sk_wmem_alloc);
return put_user(amount, (int *)arg); return put_user(amount, (int __user *)arg);
} }
case SIOCINQ: case SIOCINQ:
...@@ -745,7 +745,7 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -745,7 +745,7 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
amount = skb->len - sizeof(struct udphdr); amount = skb->len - sizeof(struct udphdr);
} }
spin_unlock_irq(&sk->sk_receive_queue.lock); spin_unlock_irq(&sk->sk_receive_queue.lock);
return put_user(amount, (int *)arg); return put_user(amount, (int __user *)arg);
} }
default: default:
......
...@@ -1510,7 +1510,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) ...@@ -1510,7 +1510,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
* Special case for SIT interfaces where we create a new "virtual" * Special case for SIT interfaces where we create a new "virtual"
* device. * device.
*/ */
int addrconf_set_dstaddr(void *arg) int addrconf_set_dstaddr(void __user *arg)
{ {
struct in6_ifreq ireq; struct in6_ifreq ireq;
struct net_device *dev; struct net_device *dev;
...@@ -1630,7 +1630,7 @@ static int inet6_addr_del(int ifindex, struct in6_addr *pfx, int plen) ...@@ -1630,7 +1630,7 @@ static int inet6_addr_del(int ifindex, struct in6_addr *pfx, int plen)
} }
int addrconf_add_ifaddr(void *arg) int addrconf_add_ifaddr(void __user *arg)
{ {
struct in6_ifreq ireq; struct in6_ifreq ireq;
int err; int err;
...@@ -1647,7 +1647,7 @@ int addrconf_add_ifaddr(void *arg) ...@@ -1647,7 +1647,7 @@ int addrconf_add_ifaddr(void *arg)
return err; return err;
} }
int addrconf_del_ifaddr(void *arg) int addrconf_del_ifaddr(void __user *arg)
{ {
struct in6_ifreq ireq; struct in6_ifreq ireq;
int err; int err;
...@@ -3003,7 +3003,7 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) ...@@ -3003,7 +3003,7 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
static static
int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp, int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
int *valp = ctl->data; int *valp = ctl->data;
int val = *valp; int val = *valp;
...@@ -3031,9 +3031,10 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp, ...@@ -3031,9 +3031,10 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
} }
static int addrconf_sysctl_forward_strategy(ctl_table *table, static int addrconf_sysctl_forward_strategy(ctl_table *table,
int *name, int nlen, int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval,
void *newval, size_t newlen, size_t __user *oldlenp,
void __user *newval, size_t newlen,
void **context) void **context)
{ {
int *valp = table->data; int *valp = table->data;
...@@ -3043,7 +3044,7 @@ static int addrconf_sysctl_forward_strategy(ctl_table *table, ...@@ -3043,7 +3044,7 @@ static int addrconf_sysctl_forward_strategy(ctl_table *table,
return 0; return 0;
if (newlen != sizeof(int)) if (newlen != sizeof(int))
return -EINVAL; return -EINVAL;
if (get_user(new, (int *)newval)) if (get_user(new, (int __user *)newval))
return -EFAULT; return -EFAULT;
if (new == *valp) if (new == *valp)
return 0; return 0;
......
...@@ -875,7 +875,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -875,7 +875,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
case SIOCOUTQ: case SIOCOUTQ:
{ {
int amount = atomic_read(&sk->sk_wmem_alloc); int amount = atomic_read(&sk->sk_wmem_alloc);
return put_user(amount, (int *)arg); return put_user(amount, (int __user *)arg);
} }
case SIOCINQ: case SIOCINQ:
{ {
...@@ -887,7 +887,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -887,7 +887,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
if (skb != NULL) if (skb != NULL)
amount = skb->tail - skb->h.raw; amount = skb->tail - skb->h.raw;
spin_unlock_irq(&sk->sk_receive_queue.lock); spin_unlock_irq(&sk->sk_receive_queue.lock);
return put_user(amount, (int *)arg); return put_user(amount, (int __user *)arg);
} }
default: default:
......
...@@ -1219,7 +1219,7 @@ void rt6_purge_dflt_routers(int last_resort) ...@@ -1219,7 +1219,7 @@ void rt6_purge_dflt_routers(int last_resort)
read_unlock_bh(&rt6_lock); read_unlock_bh(&rt6_lock);
} }
int ipv6_route_ioctl(unsigned int cmd, void *arg) int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
{ {
struct in6_rtmsg rtmsg; struct in6_rtmsg rtmsg;
int err; int err;
...@@ -1886,7 +1886,7 @@ static int flush_delay; ...@@ -1886,7 +1886,7 @@ static int flush_delay;
static static
int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp, int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
if (write) { if (write) {
proc_dointvec(ctl, write, filp, buffer, lenp); proc_dointvec(ctl, write, filp, buffer, lenp);
......
...@@ -1450,7 +1450,7 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1450,7 +1450,7 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
case SIOCOUTQ: case SIOCOUTQ:
{ {
int amount = atomic_read(&sk->sk_wmem_alloc); int amount = atomic_read(&sk->sk_wmem_alloc);
return put_user(amount, (int *)arg); return put_user(amount, (int __user *)arg);
} }
case SIOCINQ: case SIOCINQ:
{ {
...@@ -1462,7 +1462,7 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1462,7 +1462,7 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
if (skb) if (skb)
amount = skb->len; amount = skb->len;
spin_unlock_bh(&sk->sk_receive_queue.lock); spin_unlock_bh(&sk->sk_receive_queue.lock);
return put_user(amount, (int *)arg); return put_user(amount, (int __user *)arg);
} }
case SIOCGSTAMP: case SIOCGSTAMP:
return sock_get_timestamp(sk, (struct timeval __user *)arg); return sock_get_timestamp(sk, (struct timeval __user *)arg);
......
...@@ -786,13 +786,13 @@ static int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -786,13 +786,13 @@ static int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case FIOSETOWN: case FIOSETOWN:
case SIOCSPGRP: case SIOCSPGRP:
err = -EFAULT; err = -EFAULT;
if (get_user(pid, (int *)arg)) if (get_user(pid, (int __user *)arg))
break; break;
err = f_setown(sock->file, pid, 1); err = f_setown(sock->file, pid, 1);
break; break;
case FIOGETOWN: case FIOGETOWN:
case SIOCGPGRP: case SIOCGPGRP:
err = put_user(sock->file->f_owner.pid, (int *)arg); err = put_user(sock->file->f_owner.pid, (int __user *)arg);
break; break;
case SIOCGIFBR: case SIOCGIFBR:
case SIOCSIFBR: case SIOCSIFBR:
......
...@@ -575,7 +575,7 @@ struct cache_reader { ...@@ -575,7 +575,7 @@ struct cache_reader {
}; };
static ssize_t static ssize_t
cache_read(struct file *filp, char *buf, size_t count, loff_t *ppos) cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
{ {
struct cache_reader *rp = filp->private_data; struct cache_reader *rp = filp->private_data;
struct cache_request *rq; struct cache_request *rq;
...@@ -656,7 +656,7 @@ cache_read(struct file *filp, char *buf, size_t count, loff_t *ppos) ...@@ -656,7 +656,7 @@ cache_read(struct file *filp, char *buf, size_t count, loff_t *ppos)
static char write_buf[8192]; /* protected by queue_io_sem */ static char write_buf[8192]; /* protected by queue_io_sem */
static ssize_t static ssize_t
cache_write(struct file *filp, const char *buf, size_t count, cache_write(struct file *filp, const char __user *buf, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
int err; int err;
...@@ -743,7 +743,7 @@ cache_ioctl(struct inode *ino, struct file *filp, ...@@ -743,7 +743,7 @@ cache_ioctl(struct inode *ino, struct file *filp,
} }
spin_unlock(&queue_lock); spin_unlock(&queue_lock);
return put_user(len, (int *)arg); return put_user(len, (int __user *)arg);
} }
static int static int
...@@ -1166,7 +1166,7 @@ static struct file_operations content_file_operations = { ...@@ -1166,7 +1166,7 @@ static struct file_operations content_file_operations = {
.release = content_release, .release = content_release,
}; };
static ssize_t read_flush(struct file *file, char *buf, static ssize_t read_flush(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data; struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data;
...@@ -1187,7 +1187,7 @@ static ssize_t read_flush(struct file *file, char *buf, ...@@ -1187,7 +1187,7 @@ static ssize_t read_flush(struct file *file, char *buf,
return len; return len;
} }
static ssize_t write_flush(struct file * file, const char * buf, static ssize_t write_flush(struct file * file, const char __user * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data; struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data;
......
...@@ -270,7 +270,7 @@ rpc_pipe_ioctl(struct inode *ino, struct file *filp, ...@@ -270,7 +270,7 @@ rpc_pipe_ioctl(struct inode *ino, struct file *filp,
msg = (struct rpc_pipe_msg *)filp->private_data; msg = (struct rpc_pipe_msg *)filp->private_data;
len += msg->len - msg->copied; len += msg->len - msg->copied;
} }
return put_user(len, (int *)arg); return put_user(len, (int __user *)arg);
default: default:
return -EINVAL; return -EINVAL;
} }
......
...@@ -58,9 +58,10 @@ rpc_unregister_sysctl(void) ...@@ -58,9 +58,10 @@ rpc_unregister_sysctl(void)
static int static int
proc_dodebug(ctl_table *table, int write, struct file *file, proc_dodebug(ctl_table *table, int write, struct file *file,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
char tmpbuf[20], *p, c; char tmpbuf[20], c, *s;
char __user *p;
unsigned int value; unsigned int value;
size_t left, len; size_t left, len;
...@@ -74,7 +75,7 @@ proc_dodebug(ctl_table *table, int write, struct file *file, ...@@ -74,7 +75,7 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
if (write) { if (write) {
if (!access_ok(VERIFY_READ, buffer, left)) if (!access_ok(VERIFY_READ, buffer, left))
return -EFAULT; return -EFAULT;
p = (char *) buffer; p = buffer;
while (left && __get_user(c, p) >= 0 && isspace(c)) while (left && __get_user(c, p) >= 0 && isspace(c))
left--, p++; left--, p++;
if (!left) if (!left)
...@@ -86,12 +87,12 @@ proc_dodebug(ctl_table *table, int write, struct file *file, ...@@ -86,12 +87,12 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
return -EFAULT; return -EFAULT;
tmpbuf[left] = '\0'; tmpbuf[left] = '\0';
for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--) for (s = tmpbuf, value = 0; '0' <= *s && *s <= '9'; s++, left--)
value = 10 * value + (*p - '0'); value = 10 * value + (*s - '0');
if (*p && !isspace(*p)) if (*s && !isspace(*s))
return -EINVAL; return -EINVAL;
while (left && isspace(*p)) while (left && isspace(*s))
left--, p++; left--, s++;
*(unsigned int *) table->data = value; *(unsigned int *) table->data = value;
/* Display the RPC tasks on writing to rpc_debug */ /* Display the RPC tasks on writing to rpc_debug */
if (table->ctl_name == CTL_RPCDEBUG) { if (table->ctl_name == CTL_RPCDEBUG) {
...@@ -106,7 +107,7 @@ proc_dodebug(ctl_table *table, int write, struct file *file, ...@@ -106,7 +107,7 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
if (__copy_to_user(buffer, tmpbuf, len)) if (__copy_to_user(buffer, tmpbuf, len))
return -EFAULT; return -EFAULT;
if ((left -= len) > 0) { if ((left -= len) > 0) {
if (put_user('\n', (char *)buffer + len)) if (put_user('\n', (char __user *)buffer + len))
return -EFAULT; return -EFAULT;
left--; left--;
} }
......
...@@ -1829,7 +1829,7 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1829,7 +1829,7 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{ {
case SIOCOUTQ: case SIOCOUTQ:
amount = atomic_read(&sk->sk_wmem_alloc); amount = atomic_read(&sk->sk_wmem_alloc);
err = put_user(amount, (int *)arg); err = put_user(amount, (int __user *)arg);
break; break;
case SIOCINQ: case SIOCINQ:
{ {
...@@ -1844,7 +1844,7 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1844,7 +1844,7 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
if (skb) if (skb)
amount=skb->len; amount=skb->len;
spin_unlock(&sk->sk_receive_queue.lock); spin_unlock(&sk->sk_receive_queue.lock);
err = put_user(amount, (int *)arg); err = put_user(amount, (int __user *)arg);
break; break;
} }
......
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