From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Chunyan Liu <cyliu@suse.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Milos Vyletel <milos.vyletel@gmail.com>
Subject: [Qemu-devel] [PATCH] raw: Fix segfault in raw_create when opts is NULL
Date: Thu, 19 Jun 2014 07:31:57 +0800 [thread overview]
Message-ID: <1403134317-6817-1-git-send-email-famz@redhat.com> (raw)
Reported-by: Milos Vyletel <milos.vyletel@gmail.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block/raw-posix.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index dacf4fb..1f45fd8 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1282,8 +1282,10 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
strstart(filename, "file:", &filename);
/* Read out options */
- total_size =
- qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_SIZE;
+ if (opts) {
+ total_size =
+ qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_SIZE;
+ }
fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
0644);
--
2.0.0
next reply other threads:[~2014-06-18 23:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 23:31 Fam Zheng [this message]
2014-06-19 0:14 ` [Qemu-devel] [PATCH] raw: Fix segfault in raw_create when opts is NULL 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=1403134317-6817-1-git-send-email-famz@redhat.com \
--to=famz@redhat.com \
--cc=cyliu@suse.com \
--cc=kwolf@redhat.com \
--cc=milos.vyletel@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 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).