netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: Michael Chan <mchan@broadcom.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Dmitry Kravkov <dmitry@broadcom.com>,
	Eddie Wai <eddie.wai@broadcom.com>,
	Eilon Greenstein <eilong@broadcom.com>
Subject: Re: [PATCH] cnic: fix double initalization of bnx2 based cards
Date: Tue, 08 Mar 2011 19:40:55 +0000	[thread overview]
Message-ID: <1299613255.4957.3.camel@bwh-desktop> (raw)
In-Reply-To: <20110308193601.GA19669@hmsreliant.think-freely.org>

On Tue, 2011-03-08 at 14:36 -0500, Neil Horman wrote:
> On Tue, Mar 08, 2011 at 11:07:57AM -0800, Michael Chan wrote:
> > 
> > On Tue, 2011-03-08 at 10:59 -0800, Ben Hutchings wrote:
> > > On Tue, 2011-03-08 at 13:56 -0500, Neil Horman wrote:
> > > > bnx2 cards can work with the cnic driver, but when the cnic driver detects a
> > > > bnx2 card, is_cnic_dev erroneously calls the initalization routines for both
> > > > bnx2 and bnx2x (the former being a regex subset of the later).
> > > 
> > > Since when does strcmp() do a regex match?
> > 
> > Yeah, strcmp() does NULL-terminated string compare, right?
> > 
> Sorry, poor choice of words.  It doesn't do a regex match, I only ment to
> illustrate that bnx2 is a substring of bnx2x.
> 
> strcmp does this:
> 
> strcmp(const char *str1, const char *str2) {
> ...
> 	while (*s1 || *s2) {
> 		...
> 	}
> ...
> }
> 
> Since bnx2 is a substring of bnx2 both if clauses are a match, since you'll hit
> the null terminator of the shorter string in both, which means we call both
> initalization functions.
[...]

If you don't even know what strcmp() does, what are you doing hacking on
the kernel?

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  reply	other threads:[~2011-03-08 19:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 18:56 [PATCH] cnic: fix double initalization of bnx2 based cards Neil Horman
2011-03-08 18:59 ` Ben Hutchings
2011-03-08 19:07   ` Michael Chan
2011-03-08 19:36     ` Neil Horman
2011-03-08 19:40       ` Ben Hutchings [this message]
2011-03-08 19:43       ` Michael Chan
2011-03-08 21:40         ` Neil Horman
2011-03-08 21:41           ` Michael Chan

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=1299613255.4957.3.camel@bwh-desktop \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=dmitry@broadcom.com \
    --cc=eddie.wai@broadcom.com \
    --cc=eilong@broadcom.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /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;
as well as URLs for NNTP newsgroup(s).