[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] should we try to stop using variable length arrays?
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] should we try to stop using variable length arrays? |
Date: |
Thu, 7 Feb 2019 14:28:07 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 2/7/19 1:30 PM, Peter Maydell wrote:
> Currently QEMU has 9 uses of variable length arrays
> (found using -Wvla):
>
>
> Should we be looking to get rid of these and turn on the -Wvla
> warning? I know the Linux kernel has recently decided to do this
> (some rationale at the start of https://lwn.net/Articles/749064/).
A big part of that article was a discussion on how hard it is to write
an eval-once macro MAX() that does not trigger a VLA, and that the
kernel settled on a second macro for use in constant contexts. Do we
want to revist my patch that would add eval-once MAX() and constant-use
MAX_CONST(), to make it easier to avoid accidental VLAs?
https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg00727.html
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature