public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
To: Ralph Campbell <ralph.campbell-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org>
Cc: Eli Cohen <eli-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
	linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v3] IB/ipoib: fix dangling pointer references to ipoib_neigh and ipoib_path
Date: Mon, 29 Mar 2010 12:03:06 -0700	[thread overview]
Message-ID: <adaeij3vtlh.fsf@roland-alpha.cisco.com> (raw)
In-Reply-To: <1269885823.4192.173.camel-/vjeY7uYZjrPXfVEPVhPGq6RkeBMCJyt@public.gmane.org> (Ralph Campbell's message of "Mon, 29 Mar 2010 11:03:43 -0700")

 > > > @@ -249,44 +252,26 @@ static int __path_add(struct net_device *dev, struct ipoib_path *path)
 > > >  			n = &pn->rb_left;
 > > >  		else if (ret > 0)
 > > >  			n = &pn->rb_right;
 > > > -		else
 > > > -			return -EEXIST;
 > > > +		else /* Should never happen since we always search first */
 > > > +			return;
 > > >  	}
 > > 
 > > Why not remove the last else and change the "else if" into else?
 > 
 > I don't understand. This is left, right, or return.
 > I'm only changing the return value to void since it is
 > never used.

It would probably be better to split that cleanup out into a separate
patch.  And since we have a "should never happen" condition in the code,
I guess we should either trust our code and just assume that it really
never happens (ie have just an if-else as Eli suggests), or add
something like a WARN_ONCE() if it actually does happen (probably safer)
-- 
Roland Dreier <rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2010-03-29 19:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-04 18:58 [PATCH v3] IB/ipoib: fix dangling pointer references to ipoib_neigh and ipoib_path Ralph Campbell
     [not found] ` <1267729108.3001.83.camel-/vjeY7uYZjrPXfVEPVhPGq6RkeBMCJyt@public.gmane.org>
2010-03-28 16:02   ` Eli Cohen
     [not found]     ` <20100328160211.GA19300-8YAHvHwT2UEvbXDkjdHOrw/a8Rv0c6iv@public.gmane.org>
2010-03-29 18:03       ` Ralph Campbell
     [not found]         ` <1269885823.4192.173.camel-/vjeY7uYZjrPXfVEPVhPGq6RkeBMCJyt@public.gmane.org>
2010-03-29 19:03           ` Roland Dreier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adaeij3vtlh.fsf@roland-alpha.cisco.com \
    --to=rdreier-fyb4gu1cfyuavxtiumwx3w@public.gmane.org \
    --cc=eli-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ralph.campbell-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox