From nobody Mon Feb 9 05:41:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1632474406; cv=none; d=zohomail.com; s=zohoarc; b=B5O2yin4Lo4BUJe7rX+qHbw2r48QAQs7TM4ZkF7PU2PD/bLSZbGy7k7qeMw8S4Vo+7As4u1/RgNhdJ4ErsAD5XvI6YHE2dNuG8HhsZPcEllnfzJQR9XN+co0McqwN8HNZwxSbQQ8BkivNuatKmeKf/B+fo2Zipx8KpUxdGbtX1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632474406; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FVk/66SMV9Z14GpKnbeJNn6b61WCANcun218vXI9kbI=; b=WviPWuSQsRzL4MbvQar1oyg4C8zuR0WNdc5T3e/kEWtNhHDY6HzqXEdHTtIvBYagI//oOJapVY2dmYeoyGH3AQLrXDEwNZD587PjTWDLztiT41l/wvDwkBYc17w5S/AvRi6SgJ7EErwIr755NSgiD57eFxGFzI4r9mYGK4JQqAU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1632474406641390.8188543413029; Fri, 24 Sep 2021 02:06:46 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-131-89Orecw5ODSz9YZ0KHvUEw-1; Fri, 24 Sep 2021 05:06:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6B74802CB3; Fri, 24 Sep 2021 09:06:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9AA4D60936; Fri, 24 Sep 2021 09:06:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6C6861806D00; Fri, 24 Sep 2021 09:06:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18O96OnQ024236 for ; Fri, 24 Sep 2021 05:06:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 82CCB5E253; Fri, 24 Sep 2021 09:06:24 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.193.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id A534D5D9DC; Fri, 24 Sep 2021 09:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632474405; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FVk/66SMV9Z14GpKnbeJNn6b61WCANcun218vXI9kbI=; b=Em3UPVOBhQzi4uWR4A1iAV+izmUHwY6mH4mYkZkc4DP85qUGYSTXeBTmyg4Scz7mn0Ffw+ r7642iRqoFTuX4DAQ3hXeycKvn5QoikhwkxSjBjQAFtWYeBYfQep4Z8GkvXQJJXwDHpIa/ erWEqBlcy+YBBDR4LBMM0Ntpu8i19cU= X-MC-Unique: 89Orecw5ODSz9YZ0KHvUEw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH 07/11] qemu-option: Allow deleting opts during qemu_opts_foreach() Date: Fri, 24 Sep 2021 11:04:23 +0200 Message-Id: <20210924090427.9218-8-kwolf@redhat.com> In-Reply-To: <20210924090427.9218-1-kwolf@redhat.com> References: <20210924090427.9218-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, armbru@redhat.com, its@irrelevant.dk, pbonzini@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1632474408807100001 Content-Type: text/plain; charset="utf-8" Use QTAILQ_FOREACH_SAFE() so that the current QemuOpts can be deleted while iterating through the whole list. Signed-off-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy --- util/qemu-option.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/qemu-option.c b/util/qemu-option.c index 61cb4a97bd..eedd08929b 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -1126,11 +1126,11 @@ int qemu_opts_foreach(QemuOptsList *list, qemu_opts= _loopfunc func, void *opaque, Error **errp) { Location loc; - QemuOpts *opts; + QemuOpts *opts, *next; int rc =3D 0; =20 loc_push_none(&loc); - QTAILQ_FOREACH(opts, &list->head, next) { + QTAILQ_FOREACH_SAFE(opts, &list->head, next, next) { loc_restore(&opts->loc); rc =3D func(opaque, opts, errp); if (rc) { --=20 2.31.1