From: Eric Blake <eblake@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.10 1/4] stubs: Add vm state change handler stubs
Date: Tue, 15 Aug 2017 07:26:57 -0500 [thread overview]
Message-ID: <4ebaff31-4480-576b-d14f-9e9e9a73ab0e@redhat.com> (raw)
In-Reply-To: <20170815040454.4223-2-famz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]
On 08/14/2017 11:04 PM, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <famz@redhat.com>
A bit sparse on the 'why' - presumably, upcoming patches will fail to
compile if the stub is not present, but mentioning what dependency this
solves never hurts.
> ---
> stubs/Makefile.objs | 1 +
> stubs/change-state-handler.c | 14 ++++++++++++++
> 2 files changed, 15 insertions(+)
> create mode 100644 stubs/change-state-handler.c
>
> +++ b/stubs/change-state-handler.c
> @@ -0,0 +1,14 @@
> +#include "qemu/osdep.h"
> +#include "qemu-common.h"
> +#include "sysemu/sysemu.h"
> +
> +VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
> + void *opaque)
> +{
> + return g_malloc0(1);
> +}
Hmm - this is NOT a VMChangeStateEntry; if it ever gets dereferenced,
the caller is (probably) accessing memory out of bounds. Presumably,
since it is a stub, this should never be called - and if that's the
case, can we just get away with returning NULL instead (I'd rather have
the caller SEGFAULT than dereference out-of-bounds into the heap, if
this stub gets used inappropriately).
> +
> +void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
> +{
> + g_free(e);
And of course, if you don't allocate anything, this can be a no-op.
> +}
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2017-08-15 12:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-15 4:04 [Qemu-devel] [PATCH for-2.10 0/4] block: Fix non-shared storage migration Fam Zheng
2017-08-15 4:04 ` [Qemu-devel] [PATCH for-2.10 1/4] stubs: Add vm state change handler stubs Fam Zheng
2017-08-15 12:26 ` Eric Blake [this message]
2017-08-15 12:44 ` Fam Zheng
2017-08-15 4:04 ` [Qemu-devel] [PATCH for-2.10 2/4] nbd: Fix order of bdrv_set_perm and bdrv_invalidate_cache Fam Zheng
2017-08-15 4:04 ` [Qemu-devel] [PATCH for-2.10 3/4] block-backend: Defer shared_perm tightening migration completion Fam Zheng
2017-08-15 11:50 ` Stefan Hajnoczi
2017-08-15 4:04 ` [Qemu-devel] [PATCH for-2.10 4/4] iotests: Add non-shared storage migration case 192 Fam Zheng
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=4ebaff31-4480-576b-d14f-9e9e9a73ab0e@redhat.com \
--to=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.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).