From nobody Mon Feb 9 00:27:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1603295116; cv=none; d=zohomail.com; s=zohoarc; b=aIFxkrswFn5WCKbRxNnfgG1mxE25T8f4rCM59128x3YF+DvGvlY0hOtV1lCNIcGLVx6XM6FoR1FdW+l/YgW4/KqmdKLNp/MGgO0mI4blV0ov+KCMDdZPvZQ275NlWphm9M1mVPhNQnbUNSPNAjDBvUf9cDfdf4aMh8h2eoR+HoU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603295116; h=Content-Type:Content-Transfer-Encoding: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=31YE3rhYUQLqB2JphuSGXn6J9HQPBQcvxlW7oI2XSY0=; b=JJNZ/oyUcxadiVUMB/75CRYRIKwIIxB9LglrPsxDZvAH1Y9UjhBffkaNlCNxNLNBFXVDwKY1N7gQ7DZubv3zY2iHEsIebgSRsAfGJUWf3qhpeI0vqMxO0ubvZArLVz2ZnyxE+A6GEnJ3wrPcSimX1pgRNy69Bckrfsdh2kH2pF0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1603295116253598.2460229471758; Wed, 21 Oct 2020 08:45:16 -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-508-5JTP4JssMd2VjcCyDTsMRA-1; Wed, 21 Oct 2020 11:45:12 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EFCFA804B6E; Wed, 21 Oct 2020 15:45:05 +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 6B49E27CD5; Wed, 21 Oct 2020 15:45:05 +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 57AA3181A06C; Wed, 21 Oct 2020 15:45:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09LFix3W032096 for ; Wed, 21 Oct 2020 11:44:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 73F815C26A; Wed, 21 Oct 2020 15:44:59 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.139]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9AA25C269 for ; Wed, 21 Oct 2020 15:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603295115; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=31YE3rhYUQLqB2JphuSGXn6J9HQPBQcvxlW7oI2XSY0=; b=Cq7B0tMLpSyoMvH6W2Cy8Uy5Y0PmIumhz2hfXowQS5gwzJ+WB2PM98k6/oYpS5V3LUcyBq YQjWRDMohVk7JpUehEsiKU7qw0n1SDRsoauIc8h2DRlr6rTgfi5QuKLrXhMNhMUdE2Ziyb RY7ANburlWc3/YYAmuAZV4IO6S6BfPU= X-MC-Unique: 5JTP4JssMd2VjcCyDTsMRA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] hyperv: Don't overwrite errors from hypervCreateInvokeParamsList() Date: Wed, 21 Oct 2020 17:44:50 +0200 Message-Id: <17013e8bfde0c7842b7f4cedc9af8555996a6cab.1603295018.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.84 on 10.5.11.23 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" The hypervCreateInvokeParamsList() function sets an error on a failure, therefore there is no need to report another error in callers. Signed-off-by: Michal Privoznik --- src/hyperv/hyperv_driver.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index d938c223dc..4b198f5b95 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1004,6 +1004,8 @@ hypervDomainShutdownFlags(virDomainPtr domain, unsign= ed int flags) =20 params =3D hypervCreateInvokeParamsList(priv, "InitiateShutdown", sele= ctor, Msvm_ShutdownComponent_WmiInfo); + if (!params) + goto cleanup; =20 hypervAddSimpleParam(params, "Force", "False"); =20 @@ -1484,10 +1486,8 @@ hypervDomainSetAutostart(virDomainPtr domain, int au= tostart) MSVM_VIRTUALSYSTEMMANAGEMENTSERV= ICE_SELECTOR, Msvm_VirtualSystemManagementServ= ice_WmiInfo); =20 - if (!params) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not create p= arams")); + if (!params) goto cleanup; - } =20 if (priv->wmiVersion =3D=3D HYPERV_WMI_VERSION_V1) { virBufferEscapeSQL(&eprQuery, @@ -1915,12 +1915,10 @@ hypervDomainSendKey(virDomainPtr domain, unsigned i= nt codeset, g_snprintf(keycodeStr, sizeof(keycodeStr), "%d", translatedKeycode= s[i]); =20 params =3D hypervCreateInvokeParamsList(priv, "PressKey", selector, - Msvm_Keyboard_WmiInfo); + Msvm_Keyboard_WmiInfo); =20 - if (!params) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not crea= te param")); + if (!params) goto cleanup; - } =20 if (hypervAddSimpleParam(params, "keyCode", keycodeStr) < 0) goto cleanup; @@ -1940,12 +1938,10 @@ hypervDomainSendKey(virDomainPtr domain, unsigned i= nt codeset, for (i =3D 0; i < nkeycodes; i++) { g_snprintf(keycodeStr, sizeof(keycodeStr), "%d", translatedKeycode= s[i]); params =3D hypervCreateInvokeParamsList(priv, "ReleaseKey", select= or, - Msvm_Keyboard_WmiInfo); + Msvm_Keyboard_WmiInfo); =20 - if (!params) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not crea= te param")); + if (!params) goto cleanup; - } =20 if (hypervAddSimpleParam(params, "keyCode", keycodeStr) < 0) goto cleanup; @@ -1998,13 +1994,11 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, uns= igned long memory, =20 if (priv->wmiVersion =3D=3D HYPERV_WMI_VERSION_V1) { params =3D hypervCreateInvokeParamsList(priv, "ModifyVirtualSystem= Resources", - MSVM_VIRTUALSYSTEMMANAGEMENTSERVICE_SELECTOR, - Msvm_VirtualSystemManagementService_WmiInfo); + MSVM_VIRTUALSYSTEMMANAGEMENT= SERVICE_SELECTOR, + Msvm_VirtualSystemManagement= Service_WmiInfo); =20 - if (!params) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not crea= te params")); + if (!params) goto cleanup; - } =20 virBufferAddLit(&eprQuery, MSVM_COMPUTERSYSTEM_WQL_SELECT); virBufferEscapeSQL(&eprQuery, "where Name =3D \"%s\"", uuid_string= ); @@ -2014,13 +2008,11 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, uns= igned long memory, goto cleanup; } else if (priv->wmiVersion =3D=3D HYPERV_WMI_VERSION_V2) { params =3D hypervCreateInvokeParamsList(priv, "ModifyResourceSetti= ngs", - MSVM_VIRTUALSYSTEMMANAGEMENTSERVICE_SELECTOR, - Msvm_VirtualSystemManagementService_WmiInfo); + MSVM_VIRTUALSYSTEMMANAGEMENT= SERVICE_SELECTOR, + Msvm_VirtualSystemManagement= Service_WmiInfo); =20 - if (!params) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not crea= te params")); + if (!params) goto cleanup; - } } =20 memResource =3D hypervCreateEmbeddedParam(priv, Msvm_MemorySettingData= _WmiInfo); --=20 2.26.2