Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428938

[PATCH net-next 02/14] rxrpc: fix uninitialized variable use [ver #2]

From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject [PATCH net-next 02/14] rxrpc: fix uninitialized variable use [ver #2]
Date 2016-06-22 18:10 +0200
Message-ID <rMST0-5Fj-45@gated-at.bofh.it> (permalink)
References <rMSSZ-5Fj-3@gated-at.bofh.it>
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903

Show all headers | View raw


From: Arnd Bergmann <arnd@arndb.de>

Hashing the peer key was introduced for AF_INET, but gcc
warns about the rxrpc_peer_hash_key function returning uninitialized
data for any other value of srx->transport.family:

net/rxrpc/peer_object.c: In function 'rxrpc_peer_hash_key':
net/rxrpc/peer_object.c:57:15: error: 'p' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Assuming that nothing else can be set here, this changes the
function to just return zero in case of an unknown address
family.

Fixes: be6e6707f6ee ("rxrpc: Rework peer object handling to use hash table and RCU")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 net/rxrpc/peer_object.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/rxrpc/peer_object.c b/net/rxrpc/peer_object.c
index faf222c21698..6baad708f3b1 100644
--- a/net/rxrpc/peer_object.c
+++ b/net/rxrpc/peer_object.c
@@ -50,6 +50,9 @@ static unsigned long rxrpc_peer_hash_key(struct rxrpc_local *local,
 		size = sizeof(srx->transport.sin.sin_addr);
 		p = (u16 *)&srx->transport.sin.sin_addr;
 		break;
+	default:
+		WARN(1, "AF_RXRPC: Unsupported transport address family\n");
+		return 0;
 	}
 
 	/* Step through the peer address in 16-bit portions for speed */

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 00/14] rxrpc: Get rid of conn bundle and transport  structs [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:10 +0200
  [PATCH net-next 01/14] rxrpc: checking for IS_ERR() instead of NULL  [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:10 +0200
  [PATCH net-next 02/14] rxrpc: fix uninitialized variable use [ver  #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:10 +0200
  [PATCH net-next 05/14] rxrpc: Fix exclusive connection handling  [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:10 +0200
  [PATCH net-next 04/14] rxrpc: Replace conn->trans->{local,  peer} with conn->params.{local, peer} [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:10 +0200
  [PATCH net-next 12/14] rxrpc: Provide more refcount helper  functions [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:10 +0200
  Re: [PATCH net-next 00/14] rxrpc: Get rid of conn bundle and transport structs [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:10 +0200
  [PATCH net-next 06/14] rxrpc: Pass sk_buff * rather than  rxrpc_host_header * to functions [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:10 +0200
  [PATCH net-next 14/14] rxrpc: Kill off the rxrpc_transport struct  [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:10 +0200
  [PATCH net-next 11/14] rxrpc: Make rxrpc_send_packet() take a  connection not a transport [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:20 +0200
  [PATCH net-next 10/14] rxrpc: Calls displayed in /proc may in  future lack a connection [ver #2] David Howells <dhowells@redhat.com> - 2016-06-22 18:20 +0200

csiph-web