qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] target-cris: Fix buffer overflow
Date: Fri, 7 Sep 2012 10:47:48 +0200	[thread overview]
Message-ID: <20120907084748.GB23158@edde.se.axis.com> (raw)
In-Reply-To: <1346737552-2390-1-git-send-email-sw@weilnetz.de>

On Tue, Sep 04, 2012 at 07:45:52AM +0200, Stefan Weil wrote:
> Report from smatch:
> 
> target-cris/translate.c:3464 cpu_dump_state(32) error:
>  buffer overflow 'env->sregs' 4 <= 255
> 
> sregs is declared 'uint32_t sregs[4][16]', so the first index must be
> less than 4.


Hi Stefan,

I think it would be better to use ARRAY_SIZE(env->sregs) instead of 4.

The cris arch allows up to 256 sregs, but we only implement 4
at the moment. There are other uses of hardcoded 4 in the code
that could be fixed aswell if you have time.

Thanks,
Edgar

      parent reply	other threads:[~2012-09-07  8:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04  5:45 [Qemu-devel] [PATCH] target-cris: Fix buffer overflow Stefan Weil
2012-09-04 16:48 ` Edgar E. Iglesias
2012-09-07  8:47 ` Edgar E. Iglesias [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=20120907084748.GB23158@edde.se.axis.com \
    --to=edgar.iglesias@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /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).