1
0
Fork 0
alistair23-linux/net/tipc
Denys Vlasenko 9b2c45d479 net: make getname() functions return length rather than use int* parameter
Changes since v1:
Added changes in these files:
    drivers/infiniband/hw/usnic/usnic_transport.c
    drivers/staging/lustre/lnet/lnet/lib-socket.c
    drivers/target/iscsi/iscsi_target_login.c
    drivers/vhost/net.c
    fs/dlm/lowcomms.c
    fs/ocfs2/cluster/tcp.c
    security/tomoyo/network.c

Before:
All these functions either return a negative error indicator,
or store length of sockaddr into "int *socklen" parameter
and return zero on success.

"int *socklen" parameter is awkward. For example, if caller does not
care, it still needs to provide on-stack storage for the value
it does not need.

None of the many FOO_getname() functions of various protocols
ever used old value of *socklen. They always just overwrite it.

This change drops this parameter, and makes all these functions, on success,
return length of sockaddr. It's always >= 0 and can be differentiated
from an error.

Tests in callers are changed from "if (err)" to "if (err < 0)", where needed.

rpc_sockname() lost "int buflen" parameter, since its only use was
to be passed to kernel_getsockname() as &buflen and subsequently
not used in any way.

Userspace API is not changed.

    text    data     bss      dec     hex filename
30108430 2633624  873672 33615726 200ef6e vmlinux.before.o
30108109 2633612  873672 33615393 200ee21 vmlinux.o

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: David S. Miller <davem@davemloft.net>
CC: linux-kernel@vger.kernel.org
CC: netdev@vger.kernel.org
CC: linux-bluetooth@vger.kernel.org
CC: linux-decnet-user@lists.sourceforge.net
CC: linux-wireless@vger.kernel.org
CC: linux-rdma@vger.kernel.org
CC: linux-sctp@vger.kernel.org
CC: linux-nfs@vger.kernel.org
CC: linux-x25@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-12 14:15:04 -05:00
..
Kconfig
Makefile Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-04 09:26:51 +09:00
addr.c
addr.h
bcast.c tipc: fall back to smaller MTU if allocation of local send skb fails 2017-12-01 15:21:25 -05:00
bcast.h tipc: make replicast a user selectable option 2017-01-20 12:10:17 -05:00
bearer.c tipc: error path leak fixes in tipc_enable_bearer() 2017-12-27 10:54:59 -05:00
bearer.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-09-01 17:42:05 -07:00
core.c netns: make struct pernet_operations::id unsigned int 2016-11-18 10:59:15 -05:00
core.h net: tipc: remove unused hardirq.h 2018-01-08 20:59:25 -05:00
discover.c net: tipc: Convert timers to use timer_setup() 2017-11-01 12:38:45 +09:00
discover.h
eth_media.c
group.c tipc: fix race between poll() and setsockopt() 2018-01-19 15:12:21 -05:00
group.h tipc: fix race between poll() and setsockopt() 2018-01-19 15:12:21 -05:00
ib_media.c
link.c tipc: fall back to smaller MTU if allocation of local send skb fails 2017-12-01 15:21:25 -05:00
link.h tipc: transfer broadcast nacks in link state messages 2016-09-02 17:10:24 -07:00
monitor.c tipc: fix tipc_mon_delete() oops in tipc_enable_bearer() error path 2017-12-27 10:55:00 -05:00
monitor.h
msg.c tipc: fix skb truesize/datasize ratio control 2018-02-08 15:30:40 -05:00
msg.h tipc: fall back to smaller MTU if allocation of local send skb fails 2017-12-01 15:21:25 -05:00
name_distr.c tipc: allocate user memory with GFP_KERNEL flag 2017-01-16 13:31:53 -05:00
name_distr.h
name_table.c tipc: fix bug during lookup of multicast destination nodes 2018-01-15 14:27:13 -05:00
name_table.h tipc: fix bug during lookup of multicast destination nodes 2018-01-15 14:27:13 -05:00
net.c netlink: pass extended ACK struct where available 2017-04-13 13:58:22 -04:00
net.h tipc: add peer removal functionality 2016-08-18 23:36:07 -07:00
netlink.c netlink: pass extended ACK struct to parsing functions 2017-04-13 13:58:22 -04:00
netlink.h
netlink_compat.c net: tipc: constify genl_ops 2017-08-23 22:31:38 -07:00
node.c tipc: fix a memory leak in tipc_nl_node_get_link() 2018-01-15 13:45:50 -05:00
node.h tipc: introduce communication groups 2017-10-13 08:46:00 -07:00
server.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2018-01-31 14:31:10 -08:00
server.h tipc: fix race condition at topology server receive 2018-01-16 14:42:41 -05:00
socket.c net: make getname() functions return length rather than use int* parameter 2018-02-12 14:15:04 -05:00
socket.h
subscr.c tipc: fix race condition at topology server receive 2018-01-16 14:42:41 -05:00
subscr.h tipc: improve groupcast scope handling 2018-01-09 12:35:58 -05:00
sysctl.c
udp_media.c tipc: call tipc_rcv() only if bearer is up in tipc_udp_recv() 2017-12-01 15:14:22 -05:00
udp_media.h tipc: add UDP remoteip dump to netlink API 2016-08-26 21:38:41 -07:00