From: Eric Blake <eblake@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Anthony Liguori" <aliguori@us.ibm.com>,
xen-devel@lists.xensource.com,
"Igor Mitsyanko" <i.mitsyanko@samsung.com>,
"Evgeny Voevodin" <e.voevodin@samsung.com>,
qemu-devel@nongnu.org, "Fabien Chouteau" <chouteau@adacore.com>,
"Alexander Graf" <agraf@suse.de>,
"Peter Crosthwaite" <peter.crosthwaite@petalogix.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Michael Walle" <michael@walle.cc>,
qemu-ppc@nongnu.org, "Paul Brook" <paul@codesourcery.com>,
"Blue Swirl" <blauwirbel@gmail.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Guan Xuetao" <gxt@mprc.pku.edu.cn>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Maksim Kozlov" <m.kozlov@samsung.com>,
"Jan Kiszka" <jan.kiszka@web.de>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Dmitry Solodkiy" <d.solodkiy@samsung.com>
Subject: Re: [Qemu-devel] [QEMU PATCH] create struct for machine initialization arguments (v2)
Date: Fri, 05 Oct 2012 14:54:24 -0600 [thread overview]
Message-ID: <506F4900.8080404@redhat.com> (raw)
In-Reply-To: <20121005204024.GF4362@otherpad.lan.raisama.net>
[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]
On 10/05/2012 02:40 PM, Eduardo Habkost wrote:
>>> - machine->init(ram_size, boot_devices,
>>> - kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
>>> + QEMUMachineInitArgs args = { .ram_size = ram_size,
>>> + .boot_device = boot_devices,
>>> + .kernel_filename = kernel_filename,
>>> + .kernel_cmdline = kernel_cmdline,
>>> + initrd_filename = initrd_filename,
>>
>> Missing dot?
>
> Funny, GCC didn't complain. Thanks for spotting it!
Eww, insidious :P. This assigned local variable initrd_filename to
itself, then put the lvalue result of that assignment as the initializer
to the next available struct member residing after .kernel_cmdline
(which happened to be .initrd_filename). That is, gcc didn't complain
because it worked by sheer dumb luck.
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 617 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Eric Blake <eblake@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Anthony Liguori" <aliguori@us.ibm.com>,
xen-devel@lists.xensource.com,
"Igor Mitsyanko" <i.mitsyanko@samsung.com>,
"Evgeny Voevodin" <e.voevodin@samsung.com>,
qemu-devel@nongnu.org, "Fabien Chouteau" <chouteau@adacore.com>,
"Alexander Graf" <agraf@suse.de>,
"Peter Crosthwaite" <peter.crosthwaite@petalogix.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Michael Walle" <michael@walle.cc>,
qemu-ppc@nongnu.org, "Paul Brook" <paul@codesourcery.com>,
"Blue Swirl" <blauwirbel@gmail.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Guan Xuetao" <gxt@mprc.pku.edu.cn>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Maksim Kozlov" <m.kozlov@samsung.com>,
"Jan Kiszka" <jan.kiszka@web.de>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Dmitry Solodkiy" <d.solodkiy@samsung.com>
Subject: Re: [QEMU PATCH] create struct for machine initialization arguments (v2)
Date: Fri, 05 Oct 2012 14:54:24 -0600 [thread overview]
Message-ID: <506F4900.8080404@redhat.com> (raw)
In-Reply-To: <20121005204024.GF4362@otherpad.lan.raisama.net>
[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]
On 10/05/2012 02:40 PM, Eduardo Habkost wrote:
>>> - machine->init(ram_size, boot_devices,
>>> - kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
>>> + QEMUMachineInitArgs args = { .ram_size = ram_size,
>>> + .boot_device = boot_devices,
>>> + .kernel_filename = kernel_filename,
>>> + .kernel_cmdline = kernel_cmdline,
>>> + initrd_filename = initrd_filename,
>>
>> Missing dot?
>
> Funny, GCC didn't complain. Thanks for spotting it!
Eww, insidious :P. This assigned local variable initrd_filename to
itself, then put the lvalue result of that assignment as the initializer
to the next available struct member residing after .kernel_cmdline
(which happened to be .initrd_filename). That is, gcc didn't complain
because it worked by sheer dumb luck.
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 617 bytes --]
next prev parent reply other threads:[~2012-10-05 20:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 20:22 [Qemu-devel] [QEMU PATCH] create struct for machine initialization arguments (v2) Eduardo Habkost
2012-10-05 20:22 ` Eduardo Habkost
2012-10-05 20:33 ` [Qemu-devel] " Max Filippov
2012-10-05 20:33 ` Max Filippov
2012-10-05 20:40 ` [Qemu-devel] " Eduardo Habkost
2012-10-05 20:40 ` Eduardo Habkost
2012-10-05 20:54 ` Eric Blake [this message]
2012-10-05 20:54 ` Eric Blake
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=506F4900.8080404@redhat.com \
--to=eblake@redhat.com \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=chouteau@adacore.com \
--cc=d.solodkiy@samsung.com \
--cc=e.voevodin@samsung.com \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=gxt@mprc.pku.edu.cn \
--cc=hpoussin@reactos.org \
--cc=i.mitsyanko@samsung.com \
--cc=jan.kiszka@web.de \
--cc=jcmvbkbc@gmail.com \
--cc=m.kozlov@samsung.com \
--cc=michael@walle.cc \
--cc=paul@codesourcery.com \
--cc=peter.crosthwaite@petalogix.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=xen-devel@lists.xensource.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.