From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Mkm-0003YA-3O for qemu-devel@nongnu.org; Fri, 02 Aug 2013 17:19:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5Ia0-0002JD-Rg for qemu-devel@nongnu.org; Fri, 02 Aug 2013 12:51:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Ia0-0002J2-Je for qemu-devel@nongnu.org; Fri, 02 Aug 2013 12:51:52 -0400 From: Markus Armbruster References: <1375428840-5275-1-git-send-email-armbru@redhat.com> <51FBB5FC.90802@redhat.com> Date: Fri, 02 Aug 2013 18:51:48 +0200 In-Reply-To: <51FBB5FC.90802@redhat.com> (Eric Blake's message of "Fri, 02 Aug 2013 07:37:00 -0600") Message-ID: <87mwp0t4rf.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] qemu-option: Guard against qemu_opts_set_defaults() misuse List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, qemu-devel@nongnu.org Eric Blake writes: > On 08/02/2013 01:34 AM, Markus Armbruster wrote: >> 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. >> > >> >> 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 >> Signed-off-by: Markus Armbruster >> --- >> util/qemu-option.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) > >> + * This code doesn't work for defaults && !list->merge_lists: when >> + * params has no id=, and list has an element with !opts->id, it >> + * appends a new element instead of returning the existing opts. >> + * However, we got no use for this case. Guard against possible > > s/got/have/ I'd be fine with fixing this on commit. > Reviewed-by: Eric Blake Thanks!