aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/net.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-09-30 19:12:20 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-30 19:12:20 -0400
commitb7058842c940ad2c08dd829b21e5c92ebe3b8758 (patch)
tree5fe78d599fc345ca0bcd4b083b79095a54b2921b /include/linux/net.h
parenteb1cf0f8f7a9e5a6d573d5bd72c015686a042db0 (diff)
net: Make setsockopt() optlen be unsigned.
This provides safety against negative optlen at the type level instead of depending upon (sometimes non-trivial) checks against this sprinkled all over the the place, in each and every implementation. Based upon work done by Arjan van de Ven and feedback from Linus Torvalds. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/net.h')
-rw-r--r--include/linux/net.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/net.h b/include/linux/net.h
index 9040a10584f7..529a0931711d 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -178,11 +178,11 @@ struct proto_ops {
178 int (*listen) (struct socket *sock, int len); 178 int (*listen) (struct socket *sock, int len);
179 int (*shutdown) (struct socket *sock, int flags); 179 int (*shutdown) (struct socket *sock, int flags);
180 int (*setsockopt)(struct socket *sock, int level, 180 int (*setsockopt)(struct socket *sock, int level,
181 int optname, char __user *optval, int optlen); 181 int optname, char __user *optval, unsigned int optlen);
182 int (*getsockopt)(struct socket *sock, int level, 182 int (*getsockopt)(struct socket *sock, int level,
183 int optname, char __user *optval, int __user *optlen); 183 int optname, char __user *optval, int __user *optlen);
184 int (*compat_setsockopt)(struct socket *sock, int level, 184 int (*compat_setsockopt)(struct socket *sock, int level,
185 int optname, char __user *optval, int optlen); 185 int optname, char __user *optval, unsigned int optlen);
186 int (*compat_getsockopt)(struct socket *sock, int level, 186 int (*compat_getsockopt)(struct socket *sock, int level,
187 int optname, char __user *optval, int __user *optlen); 187 int optname, char __user *optval, int __user *optlen);
188 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 188 int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
@@ -256,7 +256,7 @@ extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
256extern int kernel_getsockopt(struct socket *sock, int level, int optname, 256extern int kernel_getsockopt(struct socket *sock, int level, int optname,
257 char *optval, int *optlen); 257 char *optval, int *optlen);
258extern int kernel_setsockopt(struct socket *sock, int level, int optname, 258extern int kernel_setsockopt(struct socket *sock, int level, int optname,
259 char *optval, int optlen); 259 char *optval, unsigned int optlen);
260extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, 260extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
261 size_t size, int flags); 261 size_t size, int flags);
262extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 262extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
@@ -313,7 +313,7 @@ SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int cmd, \
313SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \ 313SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
314SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \ 314SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
315SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \ 315SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
316 char __user *optval, int optlen), (sock, level, optname, optval, optlen)) \ 316 char __user *optval, unsigned int optlen), (sock, level, optname, optval, optlen)) \
317SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \ 317SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \
318 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \ 318 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \
319SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \ 319SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \