Netdev List
 help / color / mirror / Atom feed
* Fw: [Bug 79811] New: ethernet/dec/tulip/tulip_core.c:592: array index check in wrong place ?
@ 2014-07-10 12:50 Stephen Hemminger
  2014-07-11  0:01 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2014-07-10 12:50 UTC (permalink / raw)
  To: netdev



Begin forwarded message:

Date: Thu, 10 Jul 2014 04:21:24 -0700
From: "bugzilla-daemon@bugzilla.kernel.org" <bugzilla-daemon@bugzilla.kernel.org>
To: "stephen@networkplumber.org" <stephen@networkplumber.org>
Subject: [Bug 79811] New: ethernet/dec/tulip/tulip_core.c:592: array index check in wrong place ?


https://bugzilla.kernel.org/show_bug.cgi?id=79811

            Bug ID: 79811
           Summary: ethernet/dec/tulip/tulip_core.c:592: array index check
                    in wrong place ?
           Product: Networking
           Version: 2.5
    Kernel Version: 3.16-rc4
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Other
          Assignee: shemminger@linux-foundation.org
          Reporter: dcb314@hotmail.com
        Regression: No

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Bug 79811] New: ethernet/dec/tulip/tulip_core.c:592: array index check in wrong place ?
  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
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-07-11  0:01 UTC (permalink / raw)
  To: stephen; +Cc: netdev

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-11  0:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox