All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Mohamed Mediouni" <mohamed@unpredictable.fr>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	"Roman Bolshakov" <rbolshakov@ddn.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-arm@nongnu.org, "Phil Dennis-Jordan" <phil@philjordan.eu>,
	"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
	"Alexander Graf" <agraf@csgraf.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [RFC PATCH v8 06/10] hw/vmapple: aes: convert MAX_LEN to a #define
Date: Wed, 16 Sep 2026 12:34:29 +0100	[thread overview]
Message-ID: <aqp-xTxJaZEFNsQA@redhat.com> (raw)
In-Reply-To: <CAFEAcA_T1Ka5M=40LYKXD1nwnEefYbjx5mG=OfWuDqwFkMcdYA@mail.gmail.com>

On Wed, Sep 16, 2026 at 12:20:33PM +0100, Peter Maydell wrote:
> On Wed, 16 Sept 2026 at 11:00, Mohamed Mediouni
> <mohamed@unpredictable.fr> wrote:
> >
> > Working around this compiler warning:
> >
> > ../hw/vmapple/aes.c:257:14: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant]
> >   257 |     char hex[MAX_LEN * 2 + 1] = "";
> >       |              ^~~~~~~~~~~~~~~
> > 1 warning generated.
> 
> I'm surprised this wasn't already caught by our '-Wvla' setting:
> we don't want to have variable length arrays at all.

The -Wgnu-folding-constant warning seems to be saying that
GCC will always evaluate this expresson at compile time
eliminating the variable length array. Presumably that
expansion happens before -Wvla gets to see the code.

IOW, this warning is saying that we're not portable to compilers
other than GCC/CLang, which is just fine by QEMU's intent.

If we don't want to change the code, it looks valid to add
-Wno-gnu-folding-constant, since we dont care about
portability to other compilers.

> 
> > Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
> > ---
> >  hw/vmapple/aes.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/vmapple/aes.c b/hw/vmapple/aes.c
> > index 553e688adb..9d062d5a7f 100644
> > --- a/hw/vmapple/aes.c
> > +++ b/hw/vmapple/aes.c
> > @@ -253,7 +253,7 @@ static bool cmd_iv(AESState *s)
> >
> >  static void dump_data(const char *desc, const void *p, size_t len)
> >  {
> > -    static const size_t MAX_LEN = 0x1000;
> > +#define MAX_LEN  0x1000
> >      char hex[MAX_LEN * 2 + 1] = "";
> >
> >      if (len > MAX_LEN) {
> > @@ -262,6 +262,7 @@ static void dump_data(const char *desc, const void *p, size_t len)
> >
> >      qemu_hexdump_to_buffer(hex, sizeof(hex), p, len);
> >      trace_aes_dump_data(desc, hex);
> > +#undef MAX_LEN
> >  }
> 
> MAX_LEN is an awkwardly generic name. I would define it outside
> the function, something like
> 
> /* Maximum amount of AES data to dump in trace events */
> #define MAX_AES_DUMP_DATA_LEN 0x1000
> 
> Then you don't need to #undef it as there's no risk of a clash.
> 
> (Really this function ought not to do the binary-to-hex
> conversion of all the data unless the trace event is actually
> enabled, which docs/devel/tracing.rst says you can do, and
> it would maybe be nice to emit at least some truncated data
> in the "more than 1K of data" case, but let's stick to fixing
> the compile issues for the moment.)
> 
> thanks
> -- PMM
> 

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



  reply	other threads:[~2026-09-16 11:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 10:00 [RFC PATCH v8 00/10] vmapple: making it work on the latest macOS host releases Mohamed Mediouni
2026-09-16 10:00 ` [RFC PATCH v8 01/10] target/arm/emulate: add ISV=0 emulation library with load/store immediate Mohamed Mediouni
2026-09-17 20:32   ` Akihiko Odaki
2026-09-16 10:00 ` [RFC PATCH v8 02/10] target/arm/emulate: add load/store register offset Mohamed Mediouni
2026-09-16 10:00 ` [RFC PATCH v8 03/10] target/arm/emulate: add load/store pair Mohamed Mediouni
2026-09-17 20:33   ` Akihiko Odaki
2026-09-16 10:00 ` [RFC PATCH v8 04/10] target/arm/hvf, whpx: wire ISV=0 emulation for data aborts Mohamed Mediouni
2026-09-17 20:37   ` Akihiko Odaki
2026-09-16 10:00 ` [RFC PATCH v8 05/10] vmapple: apple-gfx: make it work on the latest macOS release Mohamed Mediouni
2026-09-17 20:37   ` Akihiko Odaki
2026-09-17 21:49     ` Mohamed Mediouni
2026-10-04  6:24       ` Akihiko Odaki
2026-09-16 10:00 ` [RFC PATCH v8 06/10] hw/vmapple: aes: convert MAX_LEN to a #define Mohamed Mediouni
2026-09-16 11:20   ` Peter Maydell
2026-09-16 11:34     ` Daniel P. Berrangé [this message]
2026-09-16 10:00 ` [RFC PATCH v8 07/10] Revert "hw/arm: Do not build VMapple machine by default" Mohamed Mediouni
2026-09-16 10:00 ` [RFC PATCH v8 08/10] vmapple: add gicv2m Mohamed Mediouni
2026-09-16 10:00 ` [RFC PATCH v8 09/10] vmapple, gicv2m: add macOS compat quirk Mohamed Mediouni
2026-09-16 10:51   ` Peter Maydell
2026-09-16 10:56     ` Mohamed Mediouni
2026-09-16 10:00 ` [RFC PATCH v8 10/10] hw/vmapple: virtio-blk: allow FileVault off Mohamed Mediouni
2026-09-17 20:37   ` Akihiko Odaki

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=aqp-xTxJaZEFNsQA@redhat.com \
    --to=berrange@redhat.com \
    --cc=agraf@csgraf.de \
    --cc=mohamed@unpredictable.fr \
    --cc=mst@redhat.com \
    --cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=phil@philjordan.eu \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rbolshakov@ddn.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.