qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Cc: "Frédéric Barrat" <fbarrat@linux.ibm.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v2] ppc/xive: Fix uint32_t overflow
Date: Mon, 18 Sep 2023 07:32:50 -0300	[thread overview]
Message-ID: <a0b4b3e8-6d86-d494-88d7-6eade5004d04@gmail.com> (raw)
In-Reply-To: <20230914154650.222111-1-clg@kaod.org>

Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,


Daniel

On 9/14/23 12:46, Cédric Le Goater wrote:
> As reported by Coverity, "idx << xive->pc_shift" is evaluated using
> 32-bit arithmetic, and then used in a context expecting a "uint64_t".
> Add a uint64_t cast.
> 
> Fixes: Coverity CID 1519049
> Fixes: b68147b7a5bf ("ppc/xive: Add support for the PC MMIOs")
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
> ---
> 
>   v2: removed extra space after cast
>   
>   hw/intc/pnv_xive.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c
> index 9b10e905195a..bda3478b1f84 100644
> --- a/hw/intc/pnv_xive.c
> +++ b/hw/intc/pnv_xive.c
> @@ -210,7 +210,7 @@ static uint64_t pnv_xive_vst_addr_remote(PnvXive *xive, uint32_t type,
>           return 0;
>       }
>   
> -    remote_addr |= idx << xive->pc_shift;
> +    remote_addr |= ((uint64_t)idx) << xive->pc_shift;
>   
>       vst_addr = address_space_ldq_be(&address_space_memory, remote_addr,
>                                       MEMTXATTRS_UNSPECIFIED, &result);


      reply	other threads:[~2023-09-18 10:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 15:46 [PATCH v2] ppc/xive: Fix uint32_t overflow Cédric Le Goater
2023-09-18 10:32 ` 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=a0b4b3e8-6d86-d494-88d7-6eade5004d04@gmail.com \
    --to=danielhb413@gmail.com \
    --cc=clg@kaod.org \
    --cc=fbarrat@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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).