Re: [PATCH 1/5] IB/user_mad: Fix bug in ib_umad_remove_one when rdma_cap_ib_mad implementation changed

Jason Gunthorpe
2015-05-12T19:15:05Z

On Mon, May 11, 2015 at 09:46:54PM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> The addition of the rdma_cap_ib_mad is technically broken in ib_umad_remove_one
> because the loop "i" value is not a port value.
>
> This bug resulted in the ib_umad failing to properly remove its resources when
> the core capability functions were converted to bit fields.
>
> NOTE: This original patch did not result in broken behavior on its own. It was
> only an issue when the implementation of rdma_cap_ib_mad was changed.

Didn't cause a bug, but is certainly wrong..

>+ if (rdma_cap_ib_mad(device, i))
>- if (rdma_cap_ib_mad(device, i + start_port(device)))

Is alot simpler. At the very least, use start_port/end_port to compute
those ranges...

Jason