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

ira.weiny
2015-05-12T21:53:28Z

On Tue, May 12, 2015 at 01:15:05PM -0600, Jason Gunthorpe wrote:
> 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...

I was really hoping to avoid making start/end port public. But you are
correct...

Additional patches on the way.

Ira