From nobody Sun May 5 03:07:01 2024 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=1614862732; cv=none; d=zohomail.com; s=zohoarc; b=MEkyZQzJXjmvBHooJLtzWPJZ7slCuzmN6J9M8STQBs93G5xKaU3eV8KjDTJWXhpnG8UrXSmh0B/IzMHlnE51V0A9V5L/qDsQw1s9bInvrzCfE1SMLQiqkAysMDlEl1lGZtrJ1IBx37Mpz6PLcBfxmcMOd9rNVK0vZMoOD+NXsEA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614862732; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=QISGByoskfOS41XQVeChIMLvOoVviNrXaT2L81GPjDI=; b=DDKk7X5xAXoMFCjubHSTFVg7yBgeY15/ao598bPzj6iFhxRdzgV9DS1125qUbBE09IYQMNMlTke3bYmFFpsm610UocSVr5F9uC3ljv64rY4FGPrkumDGYhlkbB+oxl2nQafb5CZ0cuE2ZfL3QY2rKZwtUQNv8fPi+azBsTk+NBM= 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) header.from= 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 1614862732272122.76410204775198; Thu, 4 Mar 2021 04:58:52 -0800 (PST) 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-195-Ou0u3dzgPUCdcCpLOgn1vA-1; Thu, 04 Mar 2021 07:58:49 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0302E801814; Thu, 4 Mar 2021 12:58:42 +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 BD12F5D71B; Thu, 4 Mar 2021 12:58:39 +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 AC08718095CA; Thu, 4 Mar 2021 12:58:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 124CwYdg032544 for ; Thu, 4 Mar 2021 07:58:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id E22535D720; Thu, 4 Mar 2021 12:58:34 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.194.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C26B5D71B for ; Thu, 4 Mar 2021 12:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614862731; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=QISGByoskfOS41XQVeChIMLvOoVviNrXaT2L81GPjDI=; b=Oawy2iAh/3WF2uJiaqhqCTNj1xAKkACIdGpZlN750ozUTuOO74Shp4owyWR50JIJkllPvg bHI984+R3+C5PPHRxmMTpdmuOi+4QAUX3F8HtGO8xFX5560L8QRpfkXpbEEQ2sZRUktJb/ XE3Aih4H2nIrdfF/swvceIqHlBj0sHM= X-MC-Unique: Ou0u3dzgPUCdcCpLOgn1vA-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH] qemu: don't raise error upon interface update without for in coalesce Date: Thu, 4 Mar 2021 13:58:17 +0100 Message-Id: <722c4d3136d2282f442201de975d30f68ddaba72.1614862642.git.khanicov@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@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.15 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) Content-Type: text/plain; charset="utf-8" With this, incomplete XML without for in coalesce won't raise error as before. It will leave the coalesce parameter empty, thanks to passing it as a parameter and return an integer to indicate error state - previously it returned pointer (or NULL for both error and incomplete XML). The code went through some refactoring: * change of a condition * addition of a parameter * change of order, that allowed removal of VIR_FREE * removal of redundant labels and variables Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1535930 Signed-off-by: Kristina Hanicova --- src/conf/domain_conf.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b731744f04..798594f520 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7516,11 +7516,11 @@ virDomainNetIPInfoParseXML(const char *source, } =20 =20 -static virNetDevCoalescePtr +static int virDomainNetDefCoalesceParseXML(xmlNodePtr node, - xmlXPathContextPtr ctxt) + xmlXPathContextPtr ctxt, + virNetDevCoalescePtr *coalesce) { - virNetDevCoalescePtr ret =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) unsigned long long tmp =3D 0; g_autofree char *str =3D NULL; @@ -7529,15 +7529,13 @@ virDomainNetDefCoalesceParseXML(xmlNodePtr node, =20 str =3D virXPathString("string(./rx/frames/@max)", ctxt); if (!str) - return NULL; - - ret =3D g_new0(virNetDevCoalesce, 1); + return 0; =20 if (virStrToLong_ullp(str, NULL, 10, &tmp) < 0) { virReportError(VIR_ERR_XML_DETAIL, _("cannot parse value '%s' for coalesce parameter"), str); - goto error; + return -1; } =20 if (tmp > UINT32_MAX) { @@ -7545,15 +7543,13 @@ virDomainNetDefCoalesceParseXML(xmlNodePtr node, _("value '%llu' is too big for coalesce " "parameter, maximum is '%lu'"), tmp, (unsigned long) UINT32_MAX); - goto error; + return -1; } - ret->rx_max_coalesced_frames =3D tmp; =20 - return ret; + *coalesce =3D g_new0(virNetDevCoalesce, 1); + (*coalesce)->rx_max_coalesced_frames =3D tmp; =20 - error: - VIR_FREE(ret); - return NULL; + return 0; } =20 static void @@ -11517,8 +11513,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, =20 node =3D virXPathNode("./coalesce", ctxt); if (node) { - def->coalesce =3D virDomainNetDefCoalesceParseXML(node, ctxt); - if (!def->coalesce) + if (virDomainNetDefCoalesceParseXML(node, ctxt, &def->coalesce) < = 0) goto error; } =20 --=20 2.29.2