qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] raw: Fix segfault in raw_create when opts is NULL
@ 2014-06-18 23:31 Fam Zheng
  2014-06-19  0:14 ` Eric Blake
  0 siblings, 1 reply; 2+ messages in thread
From: Fam Zheng @ 2014-06-18 23:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Chunyan Liu, Stefan Hajnoczi, Milos Vyletel

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-19  0:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-18 23:31 [Qemu-devel] [PATCH] raw: Fix segfault in raw_create when opts is NULL Fam Zheng
2014-06-19  0:14 ` Eric Blake

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).