Skip to content

Commit 2f9f9f5

Browse files
arndbdhowells
authored andcommitted
rxrpc: fix uninitialized variable use
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 <[email protected]> Signed-off-by: David Howells <[email protected]>
1 parent 0e4699e commit 2f9f9f5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/rxrpc/peer_object.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ static unsigned long rxrpc_peer_hash_key(struct rxrpc_local *local,
5050
size = sizeof(srx->transport.sin.sin_addr);
5151
p = (u16 *)&srx->transport.sin.sin_addr;
5252
break;
53+
default:
54+
WARN(1, "AF_RXRPC: Unsupported transport address family\n");
55+
return 0;
5356
}
5457

5558
/* Step through the peer address in 16-bit portions for speed */

0 commit comments

Comments
 (0)