vxlan: silence one build warning
Subsystems (2)
PATCH v2 1/3 vxlan: silence one build warning
From: Zhi Yong Wu <[email protected]>
drivers/net/vxlan.c: In function ‘vxlan_sock_add’:drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
LD drivers/net/built-in.o
--- drivers/net/vxlan.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)
drivers/net/vxlan.c +14 -17
@@ -2180,7 +2180,7 @@ static void vxlan_del_work(struct work_struct *work)* could be used for both IPv4 and IPv6 communications, but * users may set bindv6only=1. */ -static int create_v6_sock (struct net *net,__be16 port,struct socket **psock) +static struct socket *create_v6_sock (struct net *net,__be16 port) {struct sock *sk;struct socket *sock;
@@ -2193,7 +2193,7 @@ static int create_v6_sock(struct net *net, __be16 port, struct socket **psock) rc =sock_create_kern (AF_INET6 ,SOCK_DGRAM ,IPPROTO_UDP , &sock);if (rc <0 ) {pr_debug ("UDPv6 socket create failed\n" ); -return rc; +return ERR_PTR (rc); }/* Put in proper namespace */
@@ -2208,28 +2208,27 @@ static int create_v6_sock(struct net *net, __be16 port, struct socket **psock)pr_debug ("bind for UDPv6 socket %pI6:%u (%d)\n" , &vxlan_addr.sin6_addr,ntohs (vxlan_addr.sin6_port), rc);sk_release_kernel (sk); - return rc; + return ERR_PTR(rc); }/* At this point, IPv6 module should have been loaded in * sock_create_kern(). */ BUG_ON (!ipv6_stub); - *psock = sock;/* Disable multicast loopback */ inet_sk (sk)->mc_loop =0 ; -return 0 ; +return sock; }#else -static int create_v6_sock (struct net *net,__be16 port,struct socket **psock) +static struct socket *create_v6_sock (struct net *net,__be16 port) { -return -EPFNOSUPPORT ; +return ERR_PTR (-EPFNOSUPPORT ); }#endif -static int create_v4_sock (struct net *net,__be16 port,struct socket **psock) +static struct socket *create_v4_sock (struct net *net,__be16 port) {struct sock *sk;struct socket *sock;
@@ -2244,7 +2243,7 @@ static int create_v4_sock(struct net *net, __be16 port, struct socket **psock) rc =sock_create_kern (AF_INET ,SOCK_DGRAM ,IPPROTO_UDP , &sock);if (rc <0 ) {pr_debug ("UDP socket create failed\n" ); -return rc; +return ERR_PTR (rc); }/* Put in proper namespace */
@@ -2257,13 +2256,12 @@ static int create_v4_sock(struct net *net, __be16 port, struct socket **psock)pr_debug ("bind for UDP socket %pI4:%u (%d)\n" , &vxlan_addr.sin_addr,ntohs (vxlan_addr.sin_port), rc);sk_release_kernel (sk); -return rc; +return ERR_PTR (rc); } - *psock = sock;/* Disable multicast loopback */ inet_sk (sk)->mc_loop =0 ; -return 0 ; +return sock; }/* Create new listen socket if needed */
@@ -2274,7 +2272,6 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,struct vxlan_sock *vs;struct socket *sock;struct sock *sk; -int rc =0 ;unsigned int h; vs =kmalloc (sizeof (*vs),GFP_KERNEL );
@@ -2287,12 +2284,12 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,INIT_WORK (&vs->del_work, vxlan_del_work);if (ipv6) - rc =create_v6_sock (net, port, &sock); + sock =create_v6_sock (net, port);else - rc =create_v4_sock (net, port, &sock); -if (rc <0 ) { + sock =create_v4_sock (net, port); +if (IS_ERR (sock)) {kfree (vs); -return ERR_PTR (rc); +return ERR_PTR (PTR_ERR (sock)); } vs->sock = sock;
Signature · 1 line
1.7.11.7
PATCH v2 2/3 net, datagram: fix the incorrect comment in zerocopy_sg_from_iovec()
From: Zhi Yong Wu <[email protected]>
--- net/core/datagram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/datagram.c +1 -1
@@ -577,7 +577,7 @@ EXPORT_SYMBOL(skb_copy_datagram_from_iovec);/** * zerocopy_sg_from_iovec - Build a zerocopy datagram from an iovec * @skb: buffer to copy -* @from: io vector to copy to +* @from: io vector to copy from * @offset: offset in the io vector to start copying from * @count: amount of vectors to copy to buffer from *
Signature · 1 line
1.7.11.7
Re: [PATCH v2 2/3] net, datagram: fix the incorrect comment in zerocopy_sg_from_iovec()
From: Zhi Yong Wu <[email protected]>
Date: Mon, 28 Oct 2013 14:01:49 +0800
Quoted 3 lines
From: Zhi Yong Wu <[email protected]>
Signed-off-by Zhi Yong Wu <[email protected]>
Applied to net-next.
PATCH v2 3/3 net, iovec: fix the incorrect comment in memcpy_fromiovecend()
In reply to Zhi Yong WuFrom: Zhi Yong Wu <[email protected]>
--- net/core/iovec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/iovec.c +1 -1
@@ -100,7 +100,7 @@ int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata,EXPORT_SYMBOL (memcpy_toiovecend);/* -* Copy iovec from kernel. Returns -EFAULT on error. +* Copy iovec to kernel. Returns -EFAULT on error. */ int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
Signature · 1 line
1.7.11.7
Re: [PATCH v2 3/3] net, iovec: fix the incorrect comment in memcpy_fromiovecend()
From: Zhi Yong Wu <[email protected]>
Date: Mon, 28 Oct 2013 14:01:50 +0800
Quoted 3 lines
From: Zhi Yong Wu <[email protected]>
Signed-off-by Zhi Yong Wu <[email protected]>
Applied to net-next
Quoted 8 lines · On Mon, 28 Oct 2013 14:01:48 +0800 Zhi Yong Wu <[email protected]> wrote:
From: Zhi Yong Wu <[email protected]>
drivers/net/vxlan.c: In function ‘vxlan_sock_add’:drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in this function [-Wmaybe-uninitialized]drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
LDdrivers/net/built-in.oSigned-off-by Zhi Yong Wu <[email protected]>
This is much better.
From: Zhi Yong Wu <[email protected]>
Date: Mon, 28 Oct 2013 14:01:48 +0800
Quoted 8 lines
From: Zhi Yong Wu <[email protected]>
drivers/net/vxlan.c: In function ‘vxlan_sock_add’:drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in this function [-Wmaybe-uninitialized]drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
LDdrivers/net/built-in.oSigned-off-by Zhi Yong Wu <[email protected]>
Applied to net-next.