From: Jeff Cody <jcody@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL)
Date: Tue, 13 Oct 2015 08:22:22 -0400 [thread overview]
Message-ID: <20151013122222.GC10945@localhost.localdomain> (raw)
In-Reply-To: <1444738660-18285-2-git-send-email-kwolf@redhat.com>
On Tue, Oct 13, 2015 at 02:17:39PM +0200, Kevin Wolf wrote:
> bdrv_unref() can be called with a NULL argument and doesn't do anything
> then. Make bdrv_unref_child() consistent with it.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/block.c b/block.c
> index f38146e..6490040 100644
> --- a/block.c
> +++ b/block.c
> @@ -1104,12 +1104,17 @@ static void bdrv_detach_child(BdrvChild *child)
>
> void bdrv_unref_child(BlockDriverState *parent, BdrvChild *child)
> {
> - BlockDriverState *child_bs = child->bs;
> + BlockDriverState *child_bs;
> +
> + if (child == NULL) {
> + return;
> + }
>
> if (child->bs->inherits_from == parent) {
> child->bs->inherits_from = NULL;
> }
>
> + child_bs = child->bs;
> bdrv_detach_child(child);
> bdrv_unref(child_bs);
> }
> --
> 1.8.3.1
>
Reviewed-by: Jeff Cody <jcody@redhat.com>
next prev parent reply other threads:[~2015-10-13 12:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 12:17 [Qemu-devel] [PATCH 0/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
2015-10-13 12:17 ` [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL) Kevin Wolf
2015-10-13 12:22 ` Jeff Cody [this message]
2015-10-13 12:17 ` [Qemu-devel] [PATCH 2/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
2015-10-13 12:35 ` Jeff Cody
2015-10-26 11:26 ` [Qemu-devel] [Qemu-block] [PATCH 0/2] " Stefan Hajnoczi
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=20151013122222.GC10945@localhost.localdomain \
--to=jcody@redhat.com \
--cc=kwolf@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).