netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Vosburgh <fubar@us.ibm.com>
To: Vitalii Demianets <vitas@nppfactor.kiev.ua>
Cc: Andy Gospodarek <andy@greyhouse.net>,
	netdev@vger.kernel.org, Takuma Umeya <tumeya@redhat.com>
Subject: Re: [PATCH net-next] bonding: fix strlen errors in sysfs
Date: Thu, 14 Jul 2011 09:02:06 -0700	[thread overview]
Message-ID: <9576.1310659326@death> (raw)
In-Reply-To: <201107141115.35452.vitas@nppfactor.kiev.ua>

Vitalii Demianets <vitas@nppfactor.kiev.ua> wrote:

>On Thursday 14 July 2011 04:57:45 Andy Gospodarek wrote:
>> -			if (strnicmp
>> -			    (slave->dev->name, buf,
>> -			     strlen(slave->dev->name)) == 0) {
>> +			int max_len = max(strlen(slave->dev->name),
>> +					  strlen(buf) - 1);
>> +			if (strnicmp(slave->dev->name, buf, max_len) == 0) {
>
>As for me there is no sense in preventing "address out of range" errors in  
>strnicmp by calculating length with strlen first. If there is missing \0 at 
>the end of the string you just shift failure point from stricmp to the strlen 
>function call.
>IMHO "maximum length" argument in strnicmp should be some appropriate constant 
>instead. Alternatively we can use count:

	I agree about using a constant, and I nominate IFNAMSIZ for that
constant.

	Also, should we really be using strnicmp?  I.e., case
insensitive?  Aren't interface names case sensitive?

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

  reply	other threads:[~2011-07-14 16:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14  1:57 [PATCH net-next] bonding: fix strlen errors in sysfs Andy Gospodarek
2011-07-14  8:15 ` Vitalii Demianets
2011-07-14 16:02   ` Jay Vosburgh [this message]
2011-07-22 20:51     ` [PATCH net-next v2] " Andy Gospodarek

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=9576.1310659326@death \
    --to=fubar@us.ibm.com \
    --cc=andy@greyhouse.net \
    --cc=netdev@vger.kernel.org \
    --cc=tumeya@redhat.com \
    --cc=vitas@nppfactor.kiev.ua \
    /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).