qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Song Gao" <gaosong@loongson.cn>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Aleksandar Rikalo" <arikalo@gmail.com>,
	"Stafford Horne" <shorne@gmail.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"David Hildenbrand" <david@redhat.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	qemu-ppc@nongnu.org, qemu-s390x@nongnu.org
Subject: Re: [PATCH 10/21] target/m68k: Initialize float_status fields in gdb set/get functions
Date: Sat, 26 Oct 2024 01:35:54 -0300	[thread overview]
Message-ID: <a6a832c5-9429-40b8-ae3f-1c90c5301f73@linaro.org> (raw)
In-Reply-To: <20241025141254.2141506-11-peter.maydell@linaro.org>

On 25/10/24 11:12, Peter Maydell wrote:
> In cf_fpu_gdb_get_reg() and cf_fpu_gdb_set_reg() we use a temporary
> float_status variable to pass to floatx80_to_float64() and
> float64_to_floatx80(), but we don't initialize it, meaning that those
> functions could access uninitialized data.  Zero-init the structs.
> 
> (We don't need to set a NaN-propagation rule here because we
> don't use these with a 2-argument fpu operation.)
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Spotted by code-inspection while I was doing the 2-NaN propagation
> patches.
> ---
>   target/m68k/helper.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/m68k/helper.c b/target/m68k/helper.c
> index 9d3db8419de..9bfc6ae97c0 100644
> --- a/target/m68k/helper.c
> +++ b/target/m68k/helper.c
> @@ -36,7 +36,7 @@ static int cf_fpu_gdb_get_reg(CPUState *cs, GByteArray *mem_buf, int n)
>       CPUM68KState *env = &cpu->env;
>   
>       if (n < 8) {
> -        float_status s;
> +        float_status s = {};
>           return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d, &s));

While here, could be renamed as 'discard' like SPARC. Regardless:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

>       }
>       switch (n) {
> @@ -56,7 +56,7 @@ static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n)
>       CPUM68KState *env = &cpu->env;
>   
>       if (n < 8) {
> -        float_status s;
> +        float_status s = {};
>           env->fregs[n].d = float64_to_floatx80(ldq_be_p(mem_buf), &s);
>           return 8;
>       }



  reply	other threads:[~2024-10-26  4:36 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25 14:12 [PATCH 00/21] softfloat: Set 2-NaN propagation rule in float_status, not at compile time Peter Maydell
2024-10-25 14:12 ` [PATCH 01/21] softfloat: Allow 2-operand NaN propagation rule to be set at runtime Peter Maydell
2024-10-28 12:07   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 02/21] tests/fp: Explicitly set 2-NaN propagation rule Peter Maydell
2024-10-25 19:27   ` Philippe Mathieu-Daudé
2024-10-28 12:07   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 03/21] target/arm: " Peter Maydell
2024-10-28 12:10   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 04/21] target/mips: " Peter Maydell
2024-10-25 19:46   ` Philippe Mathieu-Daudé
2024-10-25 14:12 ` [PATCH 05/21] target/loongarch: " Peter Maydell
2024-10-28 12:13   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 06/21] target/hppa: " Peter Maydell
2024-10-28 12:14   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 07/21] target/s390x: " Peter Maydell
2024-10-25 17:45   ` Ilya Leoshkevich
2024-10-26  4:40   ` Philippe Mathieu-Daudé
2024-10-28 12:15   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 08/21] target/ppc: " Peter Maydell
2024-10-28 12:16   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 09/21] target/m68k: " Peter Maydell
2024-10-26  4:36   ` Philippe Mathieu-Daudé
2024-10-28 12:18   ` Richard Henderson
2024-10-29 10:10   ` Peter Maydell
2024-10-25 14:12 ` [PATCH 10/21] target/m68k: Initialize float_status fields in gdb set/get functions Peter Maydell
2024-10-26  4:35   ` Philippe Mathieu-Daudé [this message]
2024-10-28 12:19   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 11/21] target/sparc: Move cpu_put_fsr(env, 0) call to reset Peter Maydell
2024-10-26  4:32   ` Philippe Mathieu-Daudé
2024-10-26 20:00   ` Mark Cave-Ayland
2024-10-28 12:20   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 12/21] target/sparc: Explicitly set 2-NaN propagation rule Peter Maydell
2024-10-26 20:03   ` Mark Cave-Ayland
2024-10-28 12:20   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 13/21] target/xtensa: Factor out calls to set_use_first_nan() Peter Maydell
2024-10-25 15:54   ` Max Filippov
2024-10-28 12:21   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 14/21] target/xtensa: Explicitly set 2-NaN propagation rule Peter Maydell
2024-10-25 15:54   ` Max Filippov
2024-10-26  4:38   ` Philippe Mathieu-Daudé
2024-10-28 12:22   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 15/21] target/i386: Set 2-NaN propagation rule explicitly Peter Maydell
2024-10-28 12:24   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 16/21] target/alpha: Explicitly set 2-NaN propagation rule Peter Maydell
2024-10-26  4:39   ` Philippe Mathieu-Daudé
2024-10-28 12:25   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 17/21] target/microblaze: Move setting of float rounding mode to reset Peter Maydell
2024-10-28 12:25   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 18/21] target/microblaze: Explicitly set 2-NaN propagation rule Peter Maydell
2024-10-26  4:39   ` Philippe Mathieu-Daudé
2024-10-28 12:26   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 19/21] target/openrisc: " Peter Maydell
2024-10-26  4:40   ` Philippe Mathieu-Daudé
2024-10-28 12:26   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 20/21] target/rx: " Peter Maydell
2024-10-26  4:29   ` Philippe Mathieu-Daudé
2024-10-28 12:27   ` Richard Henderson
2024-10-25 14:12 ` [PATCH 21/21] softfloat: Remove fallback rule from pickNaN() Peter Maydell
2024-10-26  4:31   ` Philippe Mathieu-Daudé
2024-10-28 12:28   ` Richard Henderson
2024-10-25 14:49 ` [PATCH 00/21] softfloat: Set 2-NaN propagation rule in float_status, not at compile time Helge Deller
2024-10-25 14:59   ` Peter Maydell
2024-10-25 18:29     ` Helge Deller

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=a6a832c5-9429-40b8-ae3f-1c90c5301f73@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=arikalo@gmail.com \
    --cc=atar4qemu@gmail.com \
    --cc=danielhb413@gmail.com \
    --cc=david@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=gaosong@loongson.cn \
    --cc=iii@linux.ibm.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=npiggin@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=shorne@gmail.com \
    --cc=thuth@redhat.com \
    --cc=ysato@users.sourceforge.jp \
    /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).