qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH 1/2] tests/qtest/xlnx-versal-trng-test.c: Drop use of variable length array
Date: Thu, 25 Jan 2024 19:59:16 +0100	[thread overview]
Message-ID: <b0fea381-7f11-444d-b53c-5c782cfad6b2@redhat.com> (raw)
In-Reply-To: <20240125173211.1786196-2-peter.maydell@linaro.org>

On 25/01/2024 18.32, Peter Maydell wrote:
> This test program is the last use of any variable length array in the
> codebase.  If we can get rid of all uses of VLAs we can make the
> compiler error on new additions.  This is a defensive measure against
> security bugs where an on-stack dynamic allocation isn't correctly
> size-checked (e.g.  CVE-2021-3527).
> 
> In this case the test code didn't even want a variable-sized
> array, it was just accidentally using syntax that gave it one.
> (The array size for C has to be an actual constant expression,
> not just something that happens to be known to be constant...)
> 
> Remove the VLA usage.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   tests/qtest/xlnx-versal-trng-test.c | 19 +++++++++++--------
>   1 file changed, 11 insertions(+), 8 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



  reply	other threads:[~2024-01-25 19:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 17:32 [PATCH 0/2] Enable -Wvla, forbidding use of variable length arrays Peter Maydell
2024-01-25 17:32 ` [PATCH 1/2] tests/qtest/xlnx-versal-trng-test.c: Drop use of variable length array Peter Maydell
2024-01-25 18:59   ` Thomas Huth [this message]
2024-01-27 14:38   ` Zhao Liu
2024-01-25 17:32 ` [PATCH 2/2] meson: Enable -Wvla Peter Maydell
2024-01-25 19:00   ` Thomas Huth
2024-01-27 14:38   ` Zhao Liu
2024-01-27  3:41 ` [PATCH 0/2] Enable -Wvla, forbidding use of variable length arrays Richard Henderson
2024-01-31 14:55 ` Thomas Huth
2024-01-31 20:00   ` Peter Maydell

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=b0fea381-7f11-444d-b53c-5c782cfad6b2@redhat.com \
    --to=thuth@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@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).