[openib-general] [PATCH] RDMA/amso1100: Fix memory leak in c2_qp_modify.

Steve Wise swise at opengridcomputing.com
Tue Dec 5 11:17:17 PST 2006


yes, this looks correct.  

Sorry I missed this or i would have acked it earlier...

Steve.

On Tue, 2006-12-05 at 11:12 -0800, Roland Dreier wrote:
> Looks right to me.  Tom/Steve, should I merge this?
> 
>  > --- org/drivers/infiniband/hw/amso1100/c2_qp.c	2006-11-15 12:40:04.000000000 +0530
>  > +++ new/drivers/infiniband/hw/amso1100/c2_qp.c	2006-11-16 18:10:03.000000000 +0530
>  > @@ -161,8 +161,10 @@ int c2_qp_modify(struct c2_dev *c2dev, s
>  >  
>  >  	if (attr_mask & IB_QP_STATE) {
>  >  		/* Ensure the state is valid */
>  > -		if (attr->qp_state < 0 || attr->qp_state > IB_QPS_ERR)
>  > -			return -EINVAL;
>  > +		if (attr->qp_state < 0 || attr->qp_state > IB_QPS_ERR) {
>  > +			err = -EINVAL;
>  > +			goto bail0;
>  > +		}
>  >  
>  >  		wr.next_qp_state = cpu_to_be32(to_c2_state(attr->qp_state));
>  >  
>  > @@ -184,9 +186,10 @@ int c2_qp_modify(struct c2_dev *c2dev, s
>  >  		if (attr->cur_qp_state != IB_QPS_RTR &&
>  >  		    attr->cur_qp_state != IB_QPS_RTS &&
>  >  		    attr->cur_qp_state != IB_QPS_SQD &&
>  > -		    attr->cur_qp_state != IB_QPS_SQE)
>  > -			return -EINVAL;
>  > -		else
>  > +		    attr->cur_qp_state != IB_QPS_SQE) {
>  > +			err = -EINVAL;
>  > +			goto bail0;
>  > +		} else
>  >  			wr.next_qp_state =
>  >  			    cpu_to_be32(to_c2_state(attr->cur_qp_state));
>  >  
>  > 





More information about the general mailing list