From: David Miller <davem@davemloft.net>
To: stephen@networkplumber.org
Cc: netdev@vger.kernel.org
Subject: Re: [Bug 79811] New: ethernet/dec/tulip/tulip_core.c:592: array index check in wrong place ?
Date: Thu, 10 Jul 2014 17:01:08 -0700 (PDT) [thread overview]
Message-ID: <20140710.170108.1244008191479717465.davem@davemloft.net> (raw)
In-Reply-To: <20140710055022.652ce61d@samsung-9>
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 10 Jul 2014 05:50:22 -0700
> Subject: [Bug 79811] New: ethernet/dec/tulip/tulip_core.c:592: array index check in wrong place ?
...
> ethernet/dec/tulip/tulip_core.c:592]: (style) Array index 'j' is used before
> limits check.
>
> for (j = 0; buf[j] != 0xee && j < 1600; j++)
>
> Suggest put limit check before index use.
This code has never actually ever been compiled for at least a decade
or two, it's ifdef protected against "way_too_many_messages" which
nothing will ever define.
This is what really eats me about automated tools sometimes, and in this case
I have two gripes:
1) The tool doesn't take into consideration that the code might never
be compiled.
2) The code actually is buggy is far more important ways, it takes a DMA mapping
cookie and dereferences it as a CPU pointer:
u8 *buf = (u8 *)(tp->rx_ring[i].buffer1);
which is guaranteed to not work.
So in actuality this entire code block should be rewritten or removed.
prev parent reply other threads:[~2014-07-11 0:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 12:50 Fw: [Bug 79811] New: ethernet/dec/tulip/tulip_core.c:592: array index check in wrong place ? Stephen Hemminger
2014-07-11 0:01 ` David Miller [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=20140710.170108.1244008191479717465.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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