Message ID | 1431395218-27693-2-git-send-email-ira.weiny@intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
> --- a/drivers/infiniband/core/user_mad.c > +++ b/drivers/infiniband/core/user_mad.c > @@ -1327,14 +1327,21 @@ free: > static void ib_umad_remove_one(struct ib_device *device) > { > struct ib_umad_device *umad_dev = ib_get_client_data(device, > &umad_client); > - int i; > + int s, e, i; > > if (!umad_dev) > return; > > - for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i) { > + if (device->node_type == RDMA_NODE_IB_SWITCH) > + s = e = 0; > + else { Please use braces on both sides of the else if either side needs it. I.e. add braces to the if-part. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Fixed Patch 5 need to be updated as well. I'll send a new series today. Ira
On Mon, May 11, 2015 at 09:46:54PM -0400, ira.weiny@intel.com wrote: > From: Ira Weiny <ira.weiny@intel.com> > > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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@intel.com wrote: > > From: Ira Weiny <ira.weiny@intel.com> > > > > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 2ff66bc..36ce192 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c @@ -1327,14 +1327,21 @@ free: static void ib_umad_remove_one(struct ib_device *device) { struct ib_umad_device *umad_dev = ib_get_client_data(device, &umad_client); - int i; + int s, e, i; if (!umad_dev) return; - for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i) { + if (device->node_type == RDMA_NODE_IB_SWITCH) + s = e = 0; + else { + s = 1; + e = device->phys_port_cnt; + } + + for (i = s; i <= e; ++i) { if (rdma_cap_ib_mad(device, i)) - ib_umad_kill_port(&umad_dev->port[i]); + ib_umad_kill_port(&umad_dev->port[i - s]); } kobject_put(&umad_dev->kobj);