On Thu, 2008-09-11 at 23:42 +0300, Eli Cohen wrote:

> > > Index: ofed_kernel-fixes/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
> > > ===================================================================
> > > --- ofed_kernel-fixes.orig/drivers/infiniband/ulp/ipoib/ipoib_verbs.c     
> > > 2008-09-08 13:07:02.000000000 +0300
> > > +++ ofed_kernel-fixes/drivers/infiniband/ulp/ipoib/ipoib_verbs.c  
> > > 2008-09-08 13:08:41.000000000 +0300
> > > @@ -234,7 +234,7 @@ int ipoib_transport_dev_init(struct net_
> > >           if (i < UD_POST_RCV_COUNT - 1)
> > >                   priv->rx_wr_draft[i].next = &priv->rx_wr_draft[i + 1];
> > >   }
> > > - priv->rx_wr_draft[i].next = NULL;
> > > + priv->rx_wr_draft[UD_POST_RCV_COUNT - 1].next = NULL;
> > >  
> > >   if (ipoib_ud_need_sg(priv->max_ib_mtu)) {
> > >           for (i = 0; i < UD_POST_RCV_COUNT; ++i) {
> > > 
> > > What do you think?
> > 
> > If you're going to keep the setting of the last item to NULL outside the
> > loop, then you can also remove the if inside the loop as you'll just
> > overwrite the last entry when you exit the loop.
> > 
> Well, yes, but then I am going to reference an entry outside the
> bounds of the array, which we want to prevent in the first place.

No, you won't be referencing it, you'll be calculating it's address,
saving that calculated result into a valid spot in the array, and then
immediately overwriting that result with NULL.  That's perfectly valid.

-- 
Doug Ledford <[EMAIL PROTECTED]>
              GPG KeyID: CFBFF194
              http://people.redhat.com/dledford

Infiniband specific RPMs available at
              http://people.redhat.com/dledford/Infiniband

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
ewg mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg

Reply via email to