All of lore.kernel.org
 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,
	Dan Carpenter <dan.carpenter@oracle.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next 01/14] rxrpc: checking for IS_ERR() instead of NULL [ver #2]
Date: Wed, 22 Jun 2016 17:02:58 +0100	[thread overview]
Message-ID: <146661137885.15011.9259809291817631304.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <146661137134.15011.10133465789054712595.stgit@warthog.procyon.org.uk>

From: Dan Carpenter <dan.carpenter@oracle.com>

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: be6e6707f6ee ('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>
---

 net/rxrpc/af_rxrpc.c    |    4 ++--
 net/rxrpc/call_accept.c |    2 +-
 net/rxrpc/input.c       |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index c83c3c75d665..9dd160bb16d2 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -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);
diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c
index 50136c76ebd1..553b67c144e5 100644
--- a/net/rxrpc/call_accept.c
+++ b/net/rxrpc/call_accept.c
@@ -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;
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 47fb167af3e4..e11e4d785127 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -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);

  reply	other threads:[~2016-06-22 16:03 UTC|newest]

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

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=146661137885.15011.9259809291817631304.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.