qemu-e2k/util
Markus Armbruster cb77d1925a qemu-option: Guard against qemu_opts_set_defaults() misuse
Commit 6d4cd40 fixed qemu_opts_set_defaults() for an existing corner
case, but broke it for another one that can't be reached in current
code.

Quote from its commit message:

    I believe [opts_parse()] attempts to do the following:

        If options don't yet exist, create new options
        Else, if defaults, modify the existing options
        Else, if list->merge_lists, modify the existing options
        Else, fail

The only caller that passes true for defaults is
qemu_opts_set_defaults().

The commit message then claims:

    A straightforward call of qemu_opts_create() does exactly that.

Wrong.  When !list->merge_lists, and the option string doesn't contain
id=, and options without ID exist, then we don't actually modify the
existing options, we create new ones.

Not reachable, because we never pass lists with !list->merge_lists to
qemu_opts_set_defaults().

Guard against possible (if unlikely) future misuse with assert().

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1375428840-5275-1-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-08-12 09:15:37 -05:00
..
acl.c acl: acl_add can't insert before last list element, fix 2013-06-21 22:52:50 +04:00
aes.c aes: Remove unused code (NDEBUG, u16) 2013-07-27 11:22:53 +04:00
bitmap.c
bitops.c
cache-utils.c
compatfd.c
crc32c.c
cutils.c qemu-io: Move qemu_strsep() to cutils.c 2013-06-06 11:27:04 +02:00
envlist.c
error.c error: add error_setg_file_open() helper 2013-06-17 11:01:14 -04:00
event_notifier-posix.c
event_notifier-win32.c
fifo8.c
hbitmap.c
hexdump.c Rename hexdump to avoid FreeBSD libutil conflict 2013-05-20 08:20:08 -05:00
host-utils.c
iov.c iov: handle EOF in iov_send_recv 2013-08-06 10:41:56 +02:00
Makefile.objs create qemu_openpty_raw() helper function and move it to a separate file 2013-06-14 14:28:43 +04:00
module.c
notify.c notify: add NotiferWithReturn so notifier list can abort 2013-06-28 09:20:26 +02:00
osdep.c
oslib-posix.c osdep: add qemu_get_local_state_pathname() 2013-05-30 11:37:37 -05:00
oslib-win32.c osdep: add qemu_get_local_state_pathname() 2013-05-30 11:37:37 -05:00
path.c
qemu-config.c
qemu-error.c add timestamp to error_report() 2013-07-10 13:42:09 -04:00
qemu-openpty.c create qemu_openpty_raw() helper function and move it to a separate file 2013-06-14 14:28:43 +04:00
qemu-option.c qemu-option: Guard against qemu_opts_set_defaults() misuse 2013-08-12 09:15:37 -05:00
qemu-progress.c
qemu-sockets.c qemu-socket: don't leak opts on error 2013-06-28 22:10:34 +04:00
qemu-thread-posix.c semaphore: fix a hangup problem under load on NetBSD hosts. 2013-08-05 11:48:00 -05:00
qemu-thread-win32.c
qemu-timer-common.c
unicode.c
uri.c