summary refs log tree commit diff stats
path: root/hw/misc/mst_fpga.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-02-21 21:13:46 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-02-23 20:35:35 +0100
commit8ee8409eff5643c677d6e5dce6620355a89c80f8 (patch)
treefa3962a96b3ea7d7dab7270012da14828f9172bc /hw/misc/mst_fpga.c
parent694baf57ae103954e2337d1fa22d1dcdfa8e2f5a (diff)
downloadfocaccia-qemu-8ee8409eff5643c677d6e5dce6620355a89c80f8.tar.gz
focaccia-qemu-8ee8409eff5643c677d6e5dce6620355a89c80f8.zip
option: Assert value string isn't null
Plenty of code relies on QemuOpt member @str not being null, including
qemu_opts_print(), qemu_opts_to_qdict(), and callbacks passed to
qemu_opt_foreach().

Begs the question whether it can be null.  Only opt_set() creates
QemuOpt.  It sets member @str to its argument @value.  Passing null
for @value would plant a time bomb.  Callers:

* opts_do_parse() can't pass null.

* qemu_opt_set() passes its argument @value.  Callers:

  - qemu_opts_from_qdict_1() can't pass null

  - qemu_opts_set() passes its argument @value, but none of its
    callers pass null.

  - Many more outside qemu-option.c, but they shouldn't pass null,
    either.

Assert member @str isn't null, so that misuse is caught right away.

Simplify parse_option_bool(), parse_option_number() and
parse_option_size() accordingly.  Best viewed with whitespace changes
ignored.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1487708048-2131-3-git-send-email-armbru@redhat.com>
Diffstat (limited to 'hw/misc/mst_fpga.c')
0 files changed, 0 insertions, 0 deletions