[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] raw: Fix segfault in raw_create when opts is NULL
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH] raw: Fix segfault in raw_create when opts is NULL |
Date: |
Thu, 19 Jun 2014 07:31:57 +0800 |
Reported-by: Milos Vyletel <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
---
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
- [Qemu-devel] [PATCH] raw: Fix segfault in raw_create when opts is NULL,
Fam Zheng <=