qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Alistair Francis <alistair.francis@wdc.com>,
	Richard Henderson <rth@twiddle.net>, Luc Michel <luc@lmichel.fr>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [PATCH] util/cutils: Silent Coverity array overrun warning in freq_to_str()
Date: Thu, 29 Oct 2020 19:16:35 +0000	[thread overview]
Message-ID: <CAFEAcA_YEfwbUXj8ypGqpR+b4-kCV==6brGiAxLsRfz88OGvfA@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA-spK9H6SWkx9FLZ2tjMZUS5qz7bJ9rFBwxLVW_fxLRGg@mail.gmail.com>

On Thu, 29 Oct 2020 at 19:13, Peter Maydell <peter.maydell@linaro.org> wrote:
> We should either consistently assume that idx can never
> get to 7 (ie don't check it in the while loop condition
> because that test can never return true) or we should
> consistently guard against it happening (by switching the
> while loop to "<=", or by handling the idx==ARRAY_SIZE(suffixes)
> case specially.)

Oops; "switching to <=" isn't the right thing; you'd need to switch
to "< ARRAY_SIZE(suffixes) - 1". Anyway I think we should
do the other of the two options, not this one.

-- PMM


  reply	other threads:[~2020-10-29 19:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 18:55 [PATCH] util/cutils: Silent Coverity array overrun warning in freq_to_str() Philippe Mathieu-Daudé
2020-10-29 18:56 ` [PATCH-for-5.2] " Philippe Mathieu-Daudé
2020-10-29 19:13 ` [PATCH] " Peter Maydell
2020-10-29 19:16   ` Peter Maydell [this message]
2020-10-29 20:40     ` Eduardo Habkost
2020-10-29 20:26 ` Eduardo Habkost

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='CAFEAcA_YEfwbUXj8ypGqpR+b4-kCV==6brGiAxLsRfz88OGvfA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=luc@lmichel.fr \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).