[rds-devel] [PATCH 10/12] ERR_PTR() dereference in net/rds/iw.c

Andy Grover andy.grover at oracle.com
Thu Apr 9 17:09:45 PDT 2009


From: Dan Carpenter <error27 at gmail.com>

rdma_create_id() returns ERR_PTR() not null.

Found by smatch (http://repo.or.cz/w/smatch.git).  Compile tested.

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27 at gmail.com>
Signed-off-by: Andy Grover <andy.grover at oracle.com>
---
 net/rds/iw.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/rds/iw.c b/net/rds/iw.c
index b732efb..d16e1cb 100644
--- a/net/rds/iw.c
+++ b/net/rds/iw.c
@@ -233,8 +233,8 @@ static int rds_iw_laddr_check(__be32 addr)
 	 * IB and iWARP capable NICs.
 	 */
 	cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP);
-	if (!cm_id)
-		return -EADDRNOTAVAIL;
+	if (IS_ERR(cm_id))
+		return PTR_ERR(cm_id);
 
 	memset(&sin, 0, sizeof(sin));
 	sin.sin_family = AF_INET;
-- 
1.5.6.3




More information about the rds-devel mailing list