[libvirt] [PATCH] _virtualboxCreateMachine: Avoid unbound stack

Peter Krempa pkrempa at redhat.com
Mon Mar 7 09:44:01 UTC 2016


On Sat, Mar 05, 2016 at 14:05:31 +0100, Michal Privoznik wrote:
> If the stars are in the right position and you're building with

One would think that electron alignment in the material of your SSD that
creates the bits that finally align to the file creating the software on
your machine would cause this ... I'm not sure that star alignment has
to do much with it.

> VBox >= 4.2.0 it will happen that compiler thinks an array
> allocated on the stack may be unbound:

There's quite a substantial semantic difference between "unbound" and

> In file included from vbox/vbox_V4_2.c:13:0:
> vbox/vbox_tmpl.c: In function '_virtualboxCreateMachine':
> vbox/vbox_tmpl.c:2811:1: error: stack usage might be unbounded [-Werror=stack-usage=]
 
... unbounded. I'd suggest you get your language straight. Plus one
other instance in the subhect.

>  _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **machine, char *uuidstr ATTRIBUTE_UNUSED)
>  ^
> 
> Well, given how the variable is declared, I had some hard time
> seeing it is actually bounded. Surprisingly compiler does not

Here it's correct!

> complain because of -Wframe-larger-than. This is because
> variable length arrays do not count into that warning.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/vbox/vbox_tmpl.c | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)

ACK, the original code was a mess ...

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160307/5d3a2275/attachment-0001.sig>


More information about the libvir-list mailing list