[rds-devel] [patch] ERR_PTR() dereference in net/rds/ib.c

Andy Grover andy.grover at oracle.com
Thu Apr 9 10:44:35 PDT 2009


Dan Carpenter wrote:
> 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 at gmail.com>
> 
> --- orig/net/rds/ib.c	2009-04-09 05:44:52.000000000 +0300
> +++ devel/net/rds/ib.c	2009-04-09 05:45:28.000000000 +0300
> @@ -224,8 +224,8 @@
>  	 * 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;

Thanks! Queued both for next rds update.

Regards -- Andy



More information about the rds-devel mailing list