linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: davem@davemloft.net
Cc: dhowells@redhat.com, netdev@vger.kernel.org,
	linux-afs@lists.infradead.org, Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next 02/14] rxrpc: fix uninitialized variable use
Date: Wed, 22 Jun 2016 10:49:56 +0100	[thread overview]
Message-ID: <146658899682.4550.7669757075121360870.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <146658898230.4550.7226255613607733759.stgit@warthog.procyon.org.uk>

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 */

  parent reply	other threads:[~2016-06-22  9:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22  9:49 [PATCH net-next 00/14] rxrpc: Get rid of conn bundle and transport structs David Howells
2016-06-22  9:49 ` [PATCH net-next 01/14] rxrpc: checking for IS_ERR() instead of NULL David Howells
2016-06-22  9:49 ` David Howells [this message]
2016-06-22  9:50 ` [PATCH net-next 03/14] rxrpc: Use structs to hold connection params and protocol info David Howells
2016-06-22  9:50 ` [PATCH net-next 04/14] rxrpc: Replace conn->trans->{local, peer} with conn->params.{local, peer} David Howells
2016-06-22  9:50 ` [PATCH net-next 05/14] rxrpc: Fix exclusive connection handling David Howells
2016-06-22  9:50 ` [PATCH net-next 06/14] rxrpc: Pass sk_buff * rather than rxrpc_host_header * to functions David Howells
2016-06-22  9:50 ` [PATCH net-next 07/14] rxrpc: rxrpc_connection_lock shouldn't be a BH lock, but conn_lock is David Howells
2016-06-22  9:50 ` [PATCH net-next 08/14] rxrpc: Use IDR to allocate client conn IDs on a machine-wide basis David Howells
2016-06-22  9:50 ` [PATCH net-next 09/14] rxrpc: Validate the net address given to rxrpc_kernel_begin_call() David Howells
2016-06-22  9:50 ` [PATCH net-next 10/14] rxrpc: Calls displayed in /proc may in future lack a connection David Howells
2016-06-22  9:51 ` [PATCH net-next 11/14] rxrpc: Make rxrpc_send_packet() take a connection not a transport David Howells
2016-06-22  9:51 ` [PATCH net-next 12/14] rxrpc: Provide more refcount helper functions David Howells
2016-06-22  9:51 ` [PATCH net-next 13/14] rxrpc: Kill the client connection bundle concept David Howells
2016-06-22  9:51 ` [PATCH net-next 14/14] rxrpc: Kill off the rxrpc_transport struct David Howells
2016-06-22 10:03 ` [PATCH net-next 00/14] rxrpc: Get rid of conn bundle and transport structs David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=146658899682.4550.7669757075121360870.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).