diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2014-06-23 12:55:22 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2014-06-23 12:55:22 +0100 |
| commit | d9c1647d896d3192cba9dbf98fb7efab876edde5 (patch) | |
| tree | a18d31b5578e0267be6ed052c6ab5096f1d127d0 /util/qemu-option.c | |
| parent | 910f66fcda2d410249697d959dcbdf8c82d77844 (diff) | |
| parent | 2bd3bce8efebe86b031beab5c0e3b9bbaec0b502 (diff) | |
| download | focaccia-qemu-d9c1647d896d3192cba9dbf98fb7efab876edde5.tar.gz focaccia-qemu-d9c1647d896d3192cba9dbf98fb7efab876edde5.zip | |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Block pull request # gpg: Signature made Mon 23 Jun 2014 09:53:49 BST using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/block-pull-request: block: asynchronously stop the VM on I/O errors vl: allow other threads to do qemu_system_vmstop_request sheepdog: fix NULL dereference in sd_create QemuOpts: check NULL opts in qemu_opt_get functions block: m25p80: Support read only bdrvs. block: m25p80: sync_page(): Deindent function body. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/qemu-option.c')
| -rw-r--r-- | util/qemu-option.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/util/qemu-option.c b/util/qemu-option.c index 836055a4d2..43de3add29 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -310,8 +310,13 @@ static void qemu_opt_del_all(QemuOpts *opts, const char *name) const char *qemu_opt_get(QemuOpts *opts, const char *name) { - QemuOpt *opt = qemu_opt_find(opts, name); + QemuOpt *opt; + if (opts == NULL) { + return NULL; + } + + opt = qemu_opt_find(opts, name); if (!opt) { const QemuOptDesc *desc = find_desc_by_name(opts->list->desc, name); if (desc && desc->def_value_str) { @@ -364,9 +369,14 @@ bool qemu_opt_has_help_opt(QemuOpts *opts) static bool qemu_opt_get_bool_helper(QemuOpts *opts, const char *name, bool defval, bool del) { - QemuOpt *opt = qemu_opt_find(opts, name); + QemuOpt *opt; bool ret = defval; + if (opts == NULL) { + return ret; + } + + opt = qemu_opt_find(opts, name); if (opt == NULL) { const QemuOptDesc *desc = find_desc_by_name(opts->list->desc, name); if (desc && desc->def_value_str) { @@ -395,9 +405,14 @@ bool qemu_opt_get_bool_del(QemuOpts *opts, const char *name, bool defval) static uint64_t qemu_opt_get_number_helper(QemuOpts *opts, const char *name, uint64_t defval, bool del) { - QemuOpt *opt = qemu_opt_find(opts, name); + QemuOpt *opt; uint64_t ret = defval; + if (opts == NULL) { + return ret; + } + + opt = qemu_opt_find(opts, name); if (opt == NULL) { const QemuOptDesc *desc = find_desc_by_name(opts->list->desc, name); if (desc && desc->def_value_str) { @@ -427,9 +442,14 @@ uint64_t qemu_opt_get_number_del(QemuOpts *opts, const char *name, static uint64_t qemu_opt_get_size_helper(QemuOpts *opts, const char *name, uint64_t defval, bool del) { - QemuOpt *opt = qemu_opt_find(opts, name); + QemuOpt *opt; uint64_t ret = defval; + if (opts == NULL) { + return ret; + } + + opt = qemu_opt_find(opts, name); if (opt == NULL) { const QemuOptDesc *desc = find_desc_by_name(opts->list->desc, name); if (desc && desc->def_value_str) { |