qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org,
	Richard Henderson <richard.henderson@linaro.org>,
	Matheus Ferst <matheus.ferst@eldorado.org.br>
Subject: Re: [PATCH v2 1/1] target/ppc: fix unreachable code in do_ldst_quad()
Date: Thu, 4 Aug 2022 15:18:44 -0300	[thread overview]
Message-ID: <6668b59a-5f04-0801-f0af-c8bb4f3d1681@gmail.com> (raw)
In-Reply-To: <CAFEAcA8Pk47gdvbPqqyx6QGVNrqUCYiKSr-KAz+oV_Z6dP7G_w@mail.gmail.com>



On 8/4/22 15:05, Peter Maydell wrote:
> On Mon, 25 Jul 2022 at 21:24, Daniel Henrique Barboza
> <danielhb413@gmail.com> wrote:
>>
>> Coverity reports that commit fc34e81acd51 ("target/ppc: add macros to
>> check privilege level") turned the following code unreachable:
>>
>> if (!prefixed && !(ctx->insns_flags2 & PPC2_LSQ_ISA207)) {
>>      /* lq and stq were privileged prior to V. 2.07 */
>>      REQUIRE_SV(ctx);
>>
>>>>>      CID 1490757:  Control flow issues  (UNREACHABLE)
>>>>>      This code cannot be reached: "if (ctx->le_mode) {
>>      if (ctx->le_mode) {
>>          gen_align_no_le(ctx);
>>          return true;
>>      }
>> }
>>
>> This happens because the macro REQUIRE_SV(), in CONFIG_USER_MODE, will
>> always result in a 'return true' statement. In fact, all REQUIRE_*
>> macros for target/ppc/translate.c behave the same way: if a condition
>> isn't met, an exception is generated and a 'return' statement is issued.
>>
>> The difference is that all other callers are using it in insns that are
>> not implemented in user mode. do_ldst_quad(), on the other hand, is user
>> mode compatible.
> 
> This is a Coverity false positive, and I'd already marked it that way
> in the Coverity UI back on the 20th. Coverity gets confused sometimes
> by ifdeffery.
> 
> So you don't need this patch, unless you think the code is genuinely
> better (more readable to humans, etc) this way.

The idea was to make Coverity happy. If Coverity is already happy then
let's drop this patch - there's no particular improvement made here that
justifies it.


Thanks,

Daniel

> 
> thanks
> -- PMM


      reply	other threads:[~2022-08-04 18:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 20:21 [PATCH v2 0/1] target/ppc: fix unreachable code in do_ldst_quad() Daniel Henrique Barboza
2022-07-25 20:21 ` [PATCH v2 1/1] " Daniel Henrique Barboza
2022-08-04 16:59   ` Matheus K. Ferst
2022-08-04 18:05   ` Peter Maydell
2022-08-04 18:18     ` Daniel Henrique Barboza [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=6668b59a-5f04-0801-f0af-c8bb4f3d1681@gmail.com \
    --to=danielhb413@gmail.com \
    --cc=clg@kaod.org \
    --cc=matheus.ferst@eldorado.org.br \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.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;
as well as URLs for NNTP newsgroup(s).