ERR_PTR() dereference in net/rds/ib.c
authorDan Carpenter <error27@gmail.com>
Thu, 9 Apr 2009 14:09:46 +0000 (14:09 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Apr 2009 00:21:22 +0000 (17:21 -0700)
rdma_create_id() doesn't return NULL, only ERR_PTR().

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

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/ib.c

index 4933b380985eb730b496dd21152dc470fff7a10c..b9bcd32431e17f19dbc7b5b835a674d59ac8edef 100644 (file)
@@ -224,8 +224,8 @@ static int rds_ib_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;