Patchwork RxRPC: Error handling for rxrpc_alloc_connection()

login
register
mail settings
Submitter David Howells
Date May 21, 2009, 1:20 p.m.
Message ID <20090521132027.12364.63780.stgit@warthog.procyon.org.uk>
Download mbox | patch
Permalink /patch/27486/
State Accepted
Delegated to: David Miller
Headers show

Comments

David Howells - May 21, 2009, 1:20 p.m.
From: Dan Carpenter <error27@gmail.com>

rxrpc_alloc_connection() doesn't return an error code on failure, it just
returns NULL.  IS_ERR(NULL) is false.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 net/rxrpc/ar-connection.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - May 21, 2009, 10:22 p.m.
From: David Howells <dhowells@redhat.com>
Date: Thu, 21 May 2009 14:20:27 +0100

> From: Dan Carpenter <error27@gmail.com>
> 
> rxrpc_alloc_connection() doesn't return an error code on failure, it just
> returns NULL.  IS_ERR(NULL) is false.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: David Howells <dhowells@redhat.com>

Applied to net-2.6, thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/rxrpc/ar-connection.c b/net/rxrpc/ar-connection.c
index 0f1218b..67e38a0 100644
--- a/net/rxrpc/ar-connection.c
+++ b/net/rxrpc/ar-connection.c
@@ -343,9 +343,9 @@  static int rxrpc_connect_exclusive(struct rxrpc_sock *rx,
 		/* not yet present - create a candidate for a new connection
 		 * and then redo the check */
 		conn = rxrpc_alloc_connection(gfp);
-		if (IS_ERR(conn)) {
-			_leave(" = %ld", PTR_ERR(conn));
-			return PTR_ERR(conn);
+		if (!conn) {
+			_leave(" = -ENOMEM");
+			return -ENOMEM;
 		}
 
 		conn->trans = trans;
@@ -508,9 +508,9 @@  int rxrpc_connect_call(struct rxrpc_sock *rx,
 		/* not yet present - create a candidate for a new connection and then
 		 * redo the check */
 		candidate = rxrpc_alloc_connection(gfp);
-		if (IS_ERR(candidate)) {
-			_leave(" = %ld", PTR_ERR(candidate));
-			return PTR_ERR(candidate);
+		if (!candidate) {
+			_leave(" = -ENOMEM");
+			return -ENOMEM;
 		}
 
 		candidate->trans = trans;