net: socket: fixed coding style issues.
Subsystems (3)
PATCH 1/1 net: socket: fixed coding style issues.
Fixed an instance where brances are used but not needed, and some lines in the comments and code that exceed the 80 character limit.
--- net/socket.c | 137 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 75 insertions(+), 62 deletions(-)
net/socket.c +75 -62
@@ -8,48 +8,48 @@* Fred N. van Kempen, <[email protected]> * * Fixes: -* Anonymous : NOTSOCK/BADF cleanup. Error fix in -* shutdown() -* Alan Cox : verify_area() fixes -* Alan Cox : Removed DDI -* Jonathan Kamens : SOCK_DGRAM reconnect bug -* Alan Cox : Moved a load of checks to the very -* top level. -* Alan Cox : Move address structures to/from user -* mode above the protocol layers. -* Rob Janssen : Allow 0 length sends. -* Alan Cox : Asynchronous I/O support (cribbed from the -* tty drivers). -* Niibe Yutaka : Asynchronous I/O for writes (4.4BSD style) -* Jeff Uphoff : Made max number of sockets command-line -* configurable. -* Matti Aarnio : Made the number of sockets dynamic, -* to be allocated when needed, and mr. -* Uphoff's max is used as max to be -* allowed to allocate. -* Linus : Argh. removed all the socket allocation -* altogether: it's in the inode now. -* Alan Cox : Made sock_alloc()/sock_release() public -* for NetROM and future kernel nfsd type -* stuff. -* Alan Cox : sendmsg/recvmsg basics. -* Tom Dyas : Export net symbols. -* Marcin Dalecki : Fixed problems with CONFIG_NET="n". -* Alan Cox : Added thread locking to sys_* calls -* for sockets. May have errors at the -* moment. -* Kevin Buhr : Fixed the dumb errors in the above. -* Andi Kleen : Some small cleanups, optimizations, -* and fixed a copy_from_user() bug. -* Tigran Aivazian : sys_send(args) calls sys_sendto(args, NULL, 0) -* Tigran Aivazian : Made listen(2) backlog sanity checks -* protocol-independent +* Anonymous : NOTSOCK/BADF cleanup. Error fix in +* shutdown() +* Alan Cox : verify_area() fixes +* Alan Cox : Removed DDI +* Jonathan Kamens : SOCK_DGRAM reconnect bug +* Alan Cox : Moved a load of checks to the very +* top level. +* Alan Cox : Move address structures to/from user +* mode above the protocol layers. +* Rob Janssen : Allow 0 length sends. +* Alan Cox : Asynchronous I/O support (cribbed from the +* tty drivers). +* Niibe Yutaka : Asynchronous I/O for writes (4.4BSD style) +* Jeff Uphoff : Made max number of sockets command-line +* configurable. +* Matti Aarnio : Made the number of sockets dynamic, +* to be allocated when needed, and mr. +* Uphoff's max is used as max to be +* allowed to allocate. +* Linus : Argh. removed all the socket allocation +* altogether: it's in the inode now. +* Alan Cox : Made sock_alloc()/sock_release() public +* for NetROM and future kernel nfsd type +* stuff. +* Alan Cox : sendmsg/recvmsg basics. +* Tom Dyas : Export net symbols. +* Marcin Dalecki : Fixed problems with CONFIG_NET="n". +* Alan Cox : Added thread locking to sys_* calls +* for sockets. May have errors at the +* moment. +* Kevin Buhr : Fixed the dumb errors in the above. +* Andi Kleen : Some small cleanups, optimizations, +* and fixed a copy_from_user() bug. +* Tigran Aivazian : sys_send(args) calls sys_sendto(args, NULL, 0) +* Tigran Aivazian : Made listen(2) backlog sanity checks +* protocol-independent * * -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version -* 2 of the License, or (at your option) any later version. +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. * * * This module is effectively the top level interface to the BSD socket
@@ -128,8 +128,9 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos, unsigned int flags);/* -* Socket files have a set of 'special' operations as well as the generic file ones. These don't appear -* in the operation structures but are done directly via the socketcall() multiplexor. +* Socket files have a set of 'special' operations as well as the generic +* file ones. These don't appear in the operation structures but are done +* directly via the socketcall() multiplexor. */ static const struct file_operations socket_file_ops = {
@@ -181,7 +182,8 @@ static DEFINE_PER_CPU(int, sockets_in_use);* invalid addresses -EFAULT is returned. On a success 0 is returned. */ -int move_addr_to_kernel (void __user *uaddr,int ulen,struct sockaddr_storage *kaddr) +int move_addr_to_kernel (void __user *uaddr,int ulen, +struct sockaddr_storage *kaddr) {if (ulen <0 || ulen >sizeof (struct sockaddr_storage ))return -EINVAL ;
@@ -584,7 +586,8 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) }EXPORT_SYMBOL (sock_sendmsg); -static int sock_sendmsg_nosec (struct socket *sock,struct msghdr *msg,size_t size) +static int sock_sendmsg_nosec (struct socket *sock,struct msghdr *msg, +size_t size) {struct kiocb iocb;struct sock_iocb siocb;
@@ -711,7 +714,8 @@ void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,EXPORT_SYMBOL_GPL (__sock_recv_ts_and_drops);static inline int __sock_recvmsg_nosec (struct kiocb *iocb,struct socket *sock, -struct msghdr *msg,size_t size,int flags) +struct msghdr *msg,size_t size, +int flags) {struct sock_iocb *si =kiocb_to_siocb (iocb);
@@ -1158,7 +1162,9 @@ static int sock_fasync(int fd, struct file *filp, int on)return 0 ; } -/* This function may be called only under socket lock or callback_lock or rcu_lock */ +/* This function may be called only under socket lock or callback_lock +* or rcu_lock. +*/ int sock_wake_async (struct socket *sock,int how,int band) {
@@ -1229,8 +1235,8 @@ int __sock_create(struct net *net, int family, int type, int protocol,/* * Allocate the socket and allow the family to set things up. if -* the protocol is 0, the family is instructed to select an appropriate -* default. +* the protocol is 0, the family is instructed to select an +* appropriate default. */ sock =sock_alloc ();if (!sock) {
@@ -1308,7 +1314,8 @@ EXPORT_SYMBOL(__sock_create);int sock_create (int family,int type,int protocol,struct socket **res) { -return __sock_create (current->nsproxy->net_ns, family, type, protocol, res,0 ); +return __sock_create (current->nsproxy->net_ns, family, type, protocol, + res,0 ); }EXPORT_SYMBOL (sock_create);
@@ -1928,9 +1935,9 @@ static int __sys_sendmsg(struct socket *sock, struct msghdr __user *msg, }/* This will also move the address data into kernel space */ -if (MSG_CMSG_COMPAT & flags) { +if (MSG_CMSG_COMPAT & flags) err =verify_compat_iovec (msg_sys, iov, &address,VERIFY_READ ); - }else +else err =verify_iovec (msg_sys, iov, &address,VERIFY_READ );if (err <0 ) goto out_freeiov;
@@ -1957,9 +1964,9 @@ static int __sys_sendmsg(struct socket *sock, struct msghdr __user *msg, } err = -EFAULT ;/* -* Careful! Before this, msg_sys->msg_control contains a user pointer. -* Afterwards, it will be a kernel pointer. Thus the compiler-assisted -* checking falls down on this. +* Careful! Before this, msg_sys->msg_control contains a user +* pointer. Afterwards, it will be a kernel pointer. Thus the +* compiler-assisted checking falls down on this. */ if (copy_from_user(ctl_buf, (void __user __force *)msg_sys->msg_control,
@@ -2010,7 +2017,8 @@ out:* BSD sendmsg interface */ -SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int, flags) +SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int, + flags) {int fput_needed, err;struct msghdr msg_sys;
@@ -2056,7 +2064,8 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,while (datagrams < vlen) {if (MSG_CMSG_COMPAT & flags) { - err =__sys_sendmsg (sock, (struct msghdr __user *)compat_entry, + err =__sys_sendmsg (sock, + (struct msghdr __user *)compat_entry, &msg_sys, flags, &used_address);if (err <0 )break ;
@@ -2132,9 +2141,9 @@ static int __sys_recvmsg(struct socket *sock, struct msghdr __user *msg, uaddr = (__force void __user *)msg_sys->msg_name; uaddr_len =COMPAT_NAMELEN (msg); -if (MSG_CMSG_COMPAT & flags) { +if (MSG_CMSG_COMPAT & flags) err =verify_compat_iovec (msg_sys, iov, &addr,VERIFY_WRITE ); - }else +else err =verify_iovec (msg_sys, iov, &addr,VERIFY_WRITE );if (err <0 ) goto out_freeiov;
@@ -2661,13 +2670,15 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32) ifc.ifc_req =NULL ; uifc =compat_alloc_user_space (sizeof (struct ifconf )); }else { -size_t len = ((ifc32.ifc_len /sizeof (struct compat_ifreq )) +1 ) * +size_t len = ((ifc32.ifc_len / +sizeof (struct compat_ifreq )) +1 ) *sizeof (struct ifreq ); uifc =compat_alloc_user_space (sizeof (struct ifconf ) + len); ifc.ifc_len = len; ifr = ifc.ifc_req = (void __user *)(uifc +1 ); ifr32 =compat_ptr (ifc32.ifcbuf); -for (i =0 ; i < ifc32.ifc_len; i +=sizeof (struct compat_ifreq )) { +for (i =0 ; i < ifc32.ifc_len; + i +=sizeof (struct compat_ifreq )) {if (copy_in_user (ifr, ifr32,sizeof (struct compat_ifreq )))return -EFAULT ; ifr++;
@@ -2832,7 +2843,8 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)return 0 ; } -static int compat_siocwandev (struct net *net,struct compat_ifreq __user *uifr32) +static int compat_siocwandev (struct net *net, +struct compat_ifreq __user *uifr32) {void __user *uptr;compat_uptr_t uptr32;
@@ -3000,7 +3012,8 @@ static int compat_sioc_ifmap(struct net *net, unsigned int cmd,return err; } -static int compat_siocshwtstamp (struct net *net,struct compat_ifreq __user *uifr32) +static int compat_siocshwtstamp (struct net *net, +struct compat_ifreq __user *uifr32) {void __user *uptr;compat_uptr_t uptr32;
Signature · 1 line
1.7.9.5
Quoted 13 lines · Matthew Shaw
Fixed an instance where brances are used but not needed, and some lines in the comments and code that exceed the 80 character limit.
Signed-off-by Matthew Shaw <[email protected]>--- net/socket.c | 137 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 75 insertions(+), 62 deletions(-)net/socket.c +0
-0
net/socket.c line 15
Quoted 8 lines
net/socket.c +0
-5@@ -8,48 +8,48 @@* Fred N. van Kempen, <[email protected]> * * Fixes: -* Anonymous : NOTSOCK/BADF cleanup. Error fix in -* shutdown() -* Alan Cox : verify_area() fixes -* Alan Cox : Removed DDI -* Jonathan Kamens : SOCK_DGRAM reconnect bug
[...]
I would question whether such lists of bug fixes are worth keeping at all. The names should probably be kept as credits, but the details are ancient history now.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 261 lines · Matthew Shaw
Fixed an instance where brances are used but not needed, and some lines in the comments and code that exceed the 80 character limit.
Signed-off-by Matthew Shaw <[email protected]>---
net/socket.c | 137 ++++++++++++++++++++++++++++++++--------------------------1 file changed, 75 insertions(+), 62 deletions(-)net/socket.c +73
-61@@ -8,48 +8,48 @@ * Fred N. van Kempen, <[email protected]> * * Fixes: - * Anonymous : NOTSOCK/BADF cleanup. Error fix in - * shutdown() - * Alan Cox : verify_area() fixes - * Alan Cox : Removed DDI - * Jonathan Kamens : SOCK_DGRAM reconnect bug - * Alan Cox : Moved a load of checks to the very - * top level. - * Alan Cox : Move address structures to/from user - * mode above the protocol layers. - * Rob Janssen : Allow 0 length sends. - * Alan Cox : Asynchronous I/O support (cribbed from the - * tty drivers). - * Niibe Yutaka : Asynchronous I/O for writes (4.4BSD style) - * Jeff Uphoff : Made max number of sockets command-line - * configurable. - * Matti Aarnio : Made the number of sockets dynamic, - * to be allocated when needed, and mr. - * Uphoff's max is used as max to be - * allowed to allocate. - * Linus : Argh. removed all the socket allocation - * altogether: it's in the inode now. - * Alan Cox : Made sock_alloc()/sock_release() public - * for NetROM and future kernel nfsd type - * stuff. - * Alan Cox : sendmsg/recvmsg basics. - * Tom Dyas : Export net symbols. - * Marcin Dalecki : Fixed problems with CONFIG_NET="n". - * Alan Cox : Added thread locking to sys_* calls - * for sockets. May have errors at the - * moment. - * Kevin Buhr : Fixed the dumb errors in the above. - * Andi Kleen : Some small cleanups, optimizations, - * and fixed a copy_from_user() bug. - * Tigran Aivazian : sys_send(args) calls sys_sendto(args, NULL, 0) - * Tigran Aivazian : Made listen(2) backlog sanity checks - * protocol-independent + * Anonymous : NOTSOCK/BADF cleanup. Error fix in + * shutdown() + * Alan Cox : verify_area() fixes + * Alan Cox : Removed DDI + * Jonathan Kamens : SOCK_DGRAM reconnect bug + * Alan Cox : Moved a load of checks to the very + * top level. + * Alan Cox : Move address structures to/from user + * mode above the protocol layers. + * Rob Janssen : Allow 0 length sends. + * Alan Cox : Asynchronous I/O support (cribbed from the + * tty drivers). + * Niibe Yutaka : Asynchronous I/O for writes (4.4BSD style) + * Jeff Uphoff : Made max number of sockets command-line + * configurable. + * Matti Aarnio : Made the number of sockets dynamic, + * to be allocated when needed, and mr. + * Uphoff's max is used as max to be + * allowed to allocate. + * Linus : Argh. removed all the socket allocation + * altogether: it's in the inode now. + * Alan Cox : Made sock_alloc()/sock_release() public + * for NetROM and future kernel nfsd type + * stuff. + * Alan Cox : sendmsg/recvmsg basics. + * Tom Dyas : Export net symbols. + * Marcin Dalecki : Fixed problems with CONFIG_NET="n". + * Alan Cox : Added thread locking to sys_* calls + * for sockets. May have errors at the + * moment. + * Kevin Buhr : Fixed the dumb errors in the above. + * Andi Kleen : Some small cleanups, optimizations, + * and fixed a copy_from_user() bug. + * Tigran Aivazian : sys_send(args) calls sys_sendto(args, NULL, 0) + * Tigran Aivazian : Made listen(2) backlog sanity checks + * protocol-independent * * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. * * * This module is effectively the top level interface to the BSD socket@@ -128,8 +128,9 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos, unsigned int flags); /* - * Socket files have a set of 'special' operations as well as the generic file ones. These don't appear - * in the operation structures but are done directly via the socketcall() multiplexor. + * Socket files have a set of 'special' operations as well as the generic + * file ones. These don't appear in the operation structures but are done + * directly via the socketcall() multiplexor. */ static const struct file_operations socket_file_ops = {@@ -181,7 +182,8 @@ static DEFINE_PER_CPU(int, sockets_in_use);* invalid addresses -EFAULT is returned. On a success 0 is returned. */ -int move_addr_to_kernel (void __user *uaddr,int ulen,struct sockaddr_storage *kaddr) +int move_addr_to_kernel (void __user *uaddr,int ulen, + struct sockaddr_storage *kaddr) { if (ulen < 0 || ulen > sizeof(struct sockaddr_storage)) return -EINVAL;@@ -584,7 +586,8 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) } EXPORT_SYMBOL(sock_sendmsg); -static int sock_sendmsg_nosec (struct socket *sock,struct msghdr *msg,size_t size) +static int sock_sendmsg_nosec (struct socket *sock,struct msghdr *msg, + size_t size) { struct kiocb iocb; struct sock_iocb siocb;@@ -711,7 +714,8 @@ void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, EXPORT_SYMBOL_GPL(__sock_recv_ts_and_drops); static inline int __sock_recvmsg_nosec(struct kiocb *iocb, struct socket *sock, - struct msghdr *msg, size_t size, int flags) + struct msghdr *msg, size_t size, + int flags) { struct sock_iocb *si = kiocb_to_siocb(iocb);@@ -1158,7 +1162,9 @@ static int sock_fasync(int fd, struct file *filp, int on) return 0; } -/* This function may be called only under socket lock or callback_lock or rcu_lock */ +/* This function may be called only under socket lock or callback_lock +* or rcu_lock. +*/ int sock_wake_async(struct socket *sock, int how, int band) {@@ -1229,8 +1235,8 @@ int __sock_create(struct net *net, int family, int type, int protocol, /* * Allocate the socket and allow the family to set things up. if - * the protocol is 0, the family is instructed to select an appropriate - * default. + * the protocol is 0, the family is instructed to select an + * appropriate default. */ sock = sock_alloc(); if (!sock) {@@ -1308,7 +1314,8 @@ EXPORT_SYMBOL(__sock_create); int sock_create(int family, int type, int protocol, struct socket **res) { - return __sock_create(current->nsproxy->net_ns, family, type, protocol, res, 0); + return __sock_create(current->nsproxy->net_ns, family, type, protocol, + res, 0); } EXPORT_SYMBOL(sock_create);@@ -1928,9 +1935,9 @@ static int __sys_sendmsg(struct socket *sock, struct msghdr __user *msg, } /* This will also move the address data into kernel space */ - if (MSG_CMSG_COMPAT & flags) { + if (MSG_CMSG_COMPAT & flags) err = verify_compat_iovec(msg_sys, iov, &address, VERIFY_READ); - } else + else err = verify_iovec(msg_sys, iov, &address, VERIFY_READ); if (err < 0) goto out_freeiov;@@ -1957,9 +1964,9 @@ static int __sys_sendmsg(struct socket *sock, struct msghdr __user *msg, } err = -EFAULT; /* - * Careful! Before this, msg_sys->msg_control contains a user pointer. - * Afterwards, it will be a kernel pointer. Thus the compiler-assisted - * checking falls down on this. + * Careful! Before this, msg_sys->msg_control contains a user + * pointer. Afterwards, it will be a kernel pointer. Thus the + * compiler-assisted checking falls down on this. */ if (copy_from_user(ctl_buf, (void __user __force *)msg_sys->msg_control,@@ -2010,7 +2017,8 @@ out:* BSD sendmsg interface */ -SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int, flags) +SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int, + flags) { int fput_needed, err; struct msghdr msg_sys;@@ -2056,7 +2064,8 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, while (datagrams < vlen) { if (MSG_CMSG_COMPAT & flags) { - err = __sys_sendmsg(sock, (struct msghdr __user *)compat_entry, + err = __sys_sendmsg(sock, + (struct msghdr __user *)compat_entry, &msg_sys, flags, &used_address); if (err < 0) break;@@ -2132,9 +2141,9 @@ static int __sys_recvmsg(struct socket *sock, struct msghdr __user *msg, uaddr = (__force void __user *)msg_sys->msg_name; uaddr_len = COMPAT_NAMELEN(msg); - if (MSG_CMSG_COMPAT & flags) { + if (MSG_CMSG_COMPAT & flags) err = verify_compat_iovec(msg_sys, iov, &addr, VERIFY_WRITE); - } else + else err = verify_iovec(msg_sys, iov, &addr, VERIFY_WRITE); if (err < 0) goto out_freeiov;@@ -2661,13 +2670,15 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32) ifc.ifc_req = NULL; uifc = compat_alloc_user_space(sizeof(struct ifconf)); } else { - size_t len = ((ifc32.ifc_len / sizeof(struct compat_ifreq)) + 1) * + size_t len = ((ifc32.ifc_len / + sizeof(struct compat_ifreq)) + 1) * sizeof(struct ifreq); uifc = compat_alloc_user_space(sizeof(struct ifconf) + len); ifc.ifc_len = len; ifr = ifc.ifc_req = (void __user *)(uifc + 1); ifr32 = compat_ptr(ifc32.ifcbuf); - for (i = 0; i < ifc32.ifc_len; i += sizeof(struct compat_ifreq)) { + for (i = 0; i < ifc32.ifc_len; + i += sizeof(struct compat_ifreq)) { if (copy_in_user(ifr, ifr32, sizeof(struct compat_ifreq))) return -EFAULT; ifr++;@@ -2832,7 +2843,8 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32) return 0; } -static int compat_siocwandev (struct net *net,struct compat_ifreq __user *uifr32) +static int compat_siocwandev (struct net *net, + struct compat_ifreq __user *uifr32) { void __user *uptr; compat_uptr_t uptr32;
net/socket.c static int compat_sioc_ifmap(struct net *net, unsigned int cmd, · line 3016
Quoted 6 lines
net/socket.c +2
-1@@ -3000,7 +3012,8 @@ static int compat_sioc_ifmap(struct net *net, unsigned int cmd, return err; } -static int compat_siocshwtstamp (struct net *net,struct compat_ifreq __user *uifr32) +static int compat_siocshwtstamp (struct net *net, + struct compat_ifreq __user *uifr32)
I think that going over the 80 chars limit is acceptable in this kind of situations. The code
looks ugly with the new formatting.
Quoted 5 lines
net/socket.c +0
-1{ void __user *uptr; compat_uptr_t uptr32; --1.7.9.5
thanks,
Daniel.