public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Arvid Brodin <arvid.brodin@alten•se>
To: Dave Jones <davej@redhat•com>
Cc: <netdev@vger•kernel.org>
Subject: Re: out of bounds writes in net/hsr/
Date: Tue, 4 Mar 2014 17:07:23 +0100	[thread overview]
Message-ID: <5315FA3B.8020700@alten.se> (raw)
In-Reply-To: <20140304032757.GA19048@redhat.com>

On 2014-03-04 04:27, Dave Jones wrote:
> I found this in coverity, and I think it's a real bug..
> 
> hsr_register_frame_in does a check that dev_idx is between 0 and 2,
> therefore, a dev_idx of 2 is possible when it gets to the array writes
> at the end of the function. 

Thanks for finding this; it is a bug (although I don't think it has 
actually lead to any out of bound accesses). 

However, I think you are a bit late - I believe this was fixed in a patch 
from Dan Carpenter just a few days ago. See

http://www.spinics.net/lists/netdev/msg272815.html


> #define HSR_MAX_DEV     (HSR_DEV_MASTER + 1)
> 
> The + 1 seems odd, and looking at the other uses of HSR_MAX_DEV, I can't
> figure out why it's there.
> 
> 	Dave
> 

Yes, maybe the names are a bit misleading, and they should be called something 
like HSR_DEVS and HSR_SLAVES instead. I.e.:

	some-type array-name[HSR_DEVS];

... where the last element is accessed by array-name[HSR_MAX_DEV].



-- 
Arvid Brodin | Consultant (Linux)
ALTEN | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden
arvid.brodin@alten•se | www.alten.se/en/

  reply	other threads:[~2014-03-04 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04  3:27 out of bounds writes in net/hsr/ Dave Jones
2014-03-04 16:07 ` Arvid Brodin [this message]
2014-03-04 16:30   ` Dave Jones

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=5315FA3B.8020700@alten.se \
    --to=arvid.brodin@alten$(echo .)se \
    --cc=davej@redhat$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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