From: Cong Wang <amwang@redhat.com>
To: Dan Carpenter <error27@gmail.com>,
Amerigo Wang <amwang@redhat.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch] net: fix an array index overflow
Date: Thu, 03 Dec 2009 16:30:34 +0800 [thread overview]
Message-ID: <4B17772A.80605@redhat.com> (raw)
In-Reply-To: <20091202132427.GE5224@bicker>
Dan Carpenter wrote:
> On Tue, Dec 01, 2009 at 03:26:02AM -0500, Amerigo Wang wrote:
>> Don't use the address of an out-of-boundary element.
>>
>> Maybe this is not harmful at runtime, but it is still
>> good to improve it.
>>
>> Signed-off-by: WANG Cong <amwang@redhat.com>
>> Cc: David S. Miller <davem@davemloft.net>
>>
>
> It may be coincidence but my static checker smatch also complains
> about the code you modified.
>
> It's the wrong idea to fix code to please a checker. You end up
> doing things like adding an extra "return -ENOTREACHED" to silence
> warnings. Then the next person who writes a checker has to figure
> out how to seperate the unreachable code which was added to suppress
> gcc warnings from bits which are unreachable because of typos.
>
> Really any code that a human can read, a static checker should also
> be able to read. Computer programs are just state machines. At
> the function level they are quite small state machines. It's all
> logic and math which computers are very good at. So it should be
> fairly easy to fix the checker. ;)
>
Well, in some cases smatch seems really wrong, but not in this
case I think, or at least, smatch is suggesting us to improve
this code.
Please check Eric's reply in this thread, his patch looks nice
for me.
Thanks.
prev parent reply other threads:[~2009-12-03 8:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-01 8:26 [Patch] net: fix an array index overflow Amerigo Wang
2009-12-01 8:48 ` Eric Dumazet
2009-12-01 8:56 ` Cong Wang
2009-12-02 13:24 ` Dan Carpenter
2009-12-03 8:30 ` Cong Wang [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=4B17772A.80605@redhat.com \
--to=amwang@redhat.com \
--cc=davem@davemloft.net \
--cc=error27@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).