From: Jeff Cody <jcody@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, sw@weilnetz.de, stefanha@redhat.com, mreitz@redhat.com
Subject: [Qemu-devel] [PATCH v2 1/5] block: allow bdrv_unref() to be passed NULL pointers
Date: Mon, 21 Jul 2014 15:52:10 -0400 [thread overview]
Message-ID: <cdfc96e83fb024e1350f3f04d1f3453a7e0b32b6.1405962961.git.jcody@redhat.com> (raw)
In-Reply-To: <cover.1405962961.git.jcody@redhat.com>
In-Reply-To: <cover.1405962961.git.jcody@redhat.com>
If bdrv_unref() is passed a NULL BDS pointer, it is safe to
exit with no operation. This will allow cleanup code to blindly
call bdrv_unref() on a BDS that has been initialized to NULL.
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
block.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block.c b/block.c
index 23f366d..f79efc8 100644
--- a/block.c
+++ b/block.c
@@ -5385,6 +5385,9 @@ void bdrv_ref(BlockDriverState *bs)
* deleted. */
void bdrv_unref(BlockDriverState *bs)
{
+ if (!bs) {
+ return;
+ }
assert(bs->refcnt > 0);
if (--bs->refcnt == 0) {
bdrv_delete(bs);
--
1.9.3
next prev parent reply other threads:[~2014-07-21 19:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-21 19:52 [Qemu-devel] [PATCH v2 0/5] Allow VPC and VDI to be created over protocols Jeff Cody
2014-07-21 19:52 ` Jeff Cody [this message]
2014-07-21 19:52 ` [Qemu-devel] [PATCH v2 2/5] block: vdi - use block layer ops in vdi_create, instead of posix calls Jeff Cody
2014-07-22 20:14 ` Max Reitz
2014-07-22 20:19 ` Jeff Cody
2014-07-22 20:20 ` Max Reitz
2014-07-21 19:52 ` [Qemu-devel] [PATCH v2 3/5] block: use the standard 'ret' instead of 'result' Jeff Cody
2014-07-21 19:52 ` [Qemu-devel] [PATCH v2 4/5] block: vpc - use block layer ops in vpc_create, instead of posix calls Jeff Cody
2014-07-21 19:52 ` [Qemu-devel] [PATCH v2 5/5] block: iotest - update 084 to test static VDI image creation Jeff Cody
2014-07-22 20:21 ` Max Reitz
2014-07-22 20:24 ` Jeff Cody
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=cdfc96e83fb024e1350f3f04d1f3453a7e0b32b6.1405962961.git.jcody@redhat.com \
--to=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
/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).