Skip to content

Commit

Permalink
rxrpc: fix uninitialized variable use
Browse files Browse the repository at this point in the history
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: be6e670 ("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>
  • Loading branch information
Arnd Bergmann authored and David Howells committed Jun 22, 2016
1 parent 0e4699e commit 2f9f9f5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/rxrpc/peer_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 2f9f9f5

Please sign in to comment.