Skip to content

Commit

Permalink
rxrpc: checking for IS_ERR() instead of NULL
Browse files Browse the repository at this point in the history
rxrpc_lookup_peer_rcu() and rxrpc_lookup_peer() return NULL on error, never
error pointers, so IS_ERR() can't be used.

Fix three callers of those functions.

Fixes: be6e670 ('rxrpc: Rework peer object handling to use hash table and RCU')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
  • Loading branch information
Dan Carpenter authored and David Howells committed Jun 22, 2016
1 parent 0e9390e commit 0e4699e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions net/rxrpc/af_rxrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ struct rxrpc_transport *rxrpc_name_to_transport(struct rxrpc_sock *rx,

/* find a remote transport endpoint from the local one */
peer = rxrpc_lookup_peer(rx->local, srx, gfp);
if (IS_ERR(peer))
return ERR_CAST(peer);
if (!peer)
return ERR_PTR(-ENOMEM);

/* find a transport */
trans = rxrpc_get_transport(rx->local, peer, gfp);
Expand Down
2 changes: 1 addition & 1 deletion net/rxrpc/call_accept.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
notification->mark = RXRPC_SKB_MARK_NEW_CALL;

peer = rxrpc_lookup_peer(local, srx, GFP_NOIO);
if (IS_ERR(peer)) {
if (!peer) {
_debug("no peer");
ret = -EBUSY;
goto error;
Expand Down
2 changes: 1 addition & 1 deletion net/rxrpc/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ static struct rxrpc_connection *rxrpc_conn_from_local(struct rxrpc_local *local,
rxrpc_get_addr_from_skb(local, skb, &srx);
rcu_read_lock();
peer = rxrpc_lookup_peer_rcu(local, &srx);
if (IS_ERR(peer))
if (!peer)
goto cant_find_peer;

trans = rxrpc_find_transport(local, peer);
Expand Down

0 comments on commit 0e4699e

Please sign in to comment.