From nobody Mon May 13 21:04:30 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=1607593295; cv=none; d=zohomail.com; s=zohoarc; b=JccMMNnzDLjnM8psdQsCifSRvMJ0FlUzHcDvaRYLwdM6nAasLX+M6sQWsCuD5YoD/jcaeFlUWekj47pHEkeS7u8xX2dv8cv1I/28g2vVX4buvp4E4OQ4PJzMCHwMWDsPEkbIAQV6iAv6kj7YGRZcWLxuXTWk5vOpipSK70/iofc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607593295; 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=2GWLdPOUe2avhXrOsFLIfi+VCUxtgNLITqbbNAARzlc=; b=dQgF4OTVaB1zCgKYtAhSKNKyGmViHlU7JdOwsrzpqV+SsD3BpPbmNJwNB2mDLMnU1juez/0Qjm1KB4mIRLhcEVX4C4S4vb2MbemT2y/vSVS8uOP3+yQqWxZkcEyiLDoH/fDnendX1Xq/VxZdxmpM8IJ2D3R4AklKcPWo/Dn/iXA= 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 1607593295977518.2132740379676; Thu, 10 Dec 2020 01:41:35 -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-51-_v7USATNMaKQs4D190zqaA-1; Thu, 10 Dec 2020 04:41:31 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB7FC100947E; Thu, 10 Dec 2020 09:41:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C7D65D9DD; Thu, 10 Dec 2020 09:41:23 +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 7C98F4A7C6; Thu, 10 Dec 2020 09:41:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BA9fHlG014829 for ; Thu, 10 Dec 2020 04:41:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8F4C36F818; Thu, 10 Dec 2020 09:41:17 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03D8A620D7 for ; Thu, 10 Dec 2020 09:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607593294; 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=2GWLdPOUe2avhXrOsFLIfi+VCUxtgNLITqbbNAARzlc=; b=G6VzDV0TFHGWf6VbxjJVsZm+WRDhs80BV7pUu47tcc/mYUIV16JGlKbihGDYFWePUCot8o B5G8oVDrV46AwGmFi00wYZiisK/NBBex7fastCgVkLX/Z/GgQF/qKT3BWSMXVTvs7TkZEa 4272TubTMEmDaGDvcKtR4YNr3mYqIhM= X-MC-Unique: _v7USATNMaKQs4D190zqaA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] virsh: virshAddressParse: check for malformed address Date: Thu, 10 Dec 2020 10:41:08 +0100 Message-Id: <769c062d93c928acaa9003bba4b4384314c23753.1607593175.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The refactor left in the 'if (addr)' check, but before 'addr' was the return value of strchr and now it's the return value of virshAddressParse. Check 'a' instead since that's the return of strchr now. Signed-off-by: J=C3=A1n Tomko Fixes: 67bf91e1c38b6569357c22b1c83f7b090badba2b Reviewed-by: Michal Privoznik --- tools/virsh-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index befa8d2448..1ef9b8d606 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -124,7 +124,7 @@ virshAddressParse(const char *str, g_autofree char *type =3D g_strdup(str); char *a =3D strchr(type, ':'); =20 - if (!addr) + if (!a) return -1; =20 *a =3D '\0'; --=20 2.26.2 From nobody Mon May 13 21:04:30 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=1607593309; cv=none; d=zohomail.com; s=zohoarc; b=NARgJHweZcPrxCfWTboAPG4mQfEbvy+c9zvMgcgbf/HYdO6pZ9v1Lcwu8ye8GNIdweU3yy90MbUbUgQLrEWPADYXmRESN+hCTEcIc/GtRXBCk8xAJLJiYXDfdSHh4gHOa8C5VOm54xrHT4UlMFxYOFzyIoFvz3fxPyQANZgn9r8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607593309; 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=lfUWfANrZ3mwTUWvBYkB0GMcbbM1r5BDks1gJ066+4k=; b=ZV4nDBp5r1U2H57RapxmQPyKkhJC+PhxHgpLxG2zLWVzbEXjs+JQBkVCR7G1CGuefQSWTiwCGFfrsiICVozl4anWhItVG3dNLTPLLwJvsZJcykCs6q7QB4odkMVTgIy9gLdlc+J+1JMNmblRDje3JGzeUj8BDzADdVFC9NoX81U= 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 1607593309753115.01308034686986; Thu, 10 Dec 2020 01:41:49 -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-561-HgiUO0UKNr6QXjMzIINcJw-1; Thu, 10 Dec 2020 04:41:46 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4550C59; Thu, 10 Dec 2020 09:41:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 229F310023AC; Thu, 10 Dec 2020 09:41:40 +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 B795C4E58F; Thu, 10 Dec 2020 09:41:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BA9fI8J014837 for ; Thu, 10 Dec 2020 04:41:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5DF355B4D1; Thu, 10 Dec 2020 09:41:18 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4F036F7E5 for ; Thu, 10 Dec 2020 09:41:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607593308; 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=lfUWfANrZ3mwTUWvBYkB0GMcbbM1r5BDks1gJ066+4k=; b=H7+YhZFYpLolgTf/tN+SzgPOUi/P02A4F4eKwbkn1hxV2j7zvu5a95MGWVkd2ZW4v7yhI5 2RtLYhb8vr+hXZoUQERzF/G4tDODmviOilcISL7NUQ4VpOQ7+m0orI2hpWyiTLoEomL55T T2Rpi8dDuZehyo3MCnHztRo0+54YqmM= X-MC-Unique: HgiUO0UKNr6QXjMzIINcJw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] qemuBuildMemoryDeviceStr: check return of qemuBuildDeviceAddressStr Date: Thu, 10 Dec 2020 10:41:09 +0100 Message-Id: <8ea26973e1fbc0ecb7fb55eab395a87814db9a21.1607593175.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.22 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Although the function currently only returns errors for PCI addresses, check it here too, in case that chamges in the future. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 76edc3c617..b06a086e18 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3317,7 +3317,8 @@ qemuBuildMemoryDeviceStr(const virDomainDef *def, virBufferAsprintf(&buf, "memdev=3Dmem%s,id=3D%s", mem->info.alias, mem->info.alias); =20 - qemuBuildDeviceAddressStr(&buf, def, &mem->info, qemuCaps); + if (qemuBuildDeviceAddressStr(&buf, def, &mem->info, qemuCaps) < 0) + return NULL; break; =20 case VIR_DOMAIN_MEMORY_MODEL_NONE: --=20 2.26.2 From nobody Mon May 13 21:04:30 2024 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=1607593312; cv=none; d=zohomail.com; s=zohoarc; b=FVRkubqHNABHWV9oxiRcn9FKeIZGNbe7bK4X6fTIyfVwkPw8xv9/01k49FkOva8MR47iEfyFEVpyFOqKpObGnZADFAP4vxiBk6AiQ5PyVT04YsPn8DGJbmF6EKfQD2YnkP7q9Y9l6ihLnUiWk3AdPZ/lqY3TiozE7MiHlOsxQ04= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607593312; 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=rGzQjLKz/9VoLf8Q6rWiJFlhECjpsDWxpe3+P63MJFY=; b=fIYKIwsAcHHLLw+JQZcZ8nt8YyR0Mqjk18DA+vlOHBnYhkEMnFiiV7a6RABPWwksju9llVkC+ip4PRsCAOsvy3OO3XaodLBHDrbnzeDk6I4CDshE/d9XWlhkkiwb5qVB72p+W8qm8nViWmB6w4nsaZeD+g4qNvCqbbiw9+5cVIw= 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 1607593312559607.452641511717; Thu, 10 Dec 2020 01:41: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-206-8bbAv4BjP3ujzxPrI23rYQ-1; Thu, 10 Dec 2020 04:41:49 -0500 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 EF3F71936B76; Thu, 10 Dec 2020 09:41:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C750719712; Thu, 10 Dec 2020 09:41:42 +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 91F604EEF6; Thu, 10 Dec 2020 09:41:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BA9fJNg014844 for ; Thu, 10 Dec 2020 04:41:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 37F381346F; Thu, 10 Dec 2020 09:41:19 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF08C1E5 for ; Thu, 10 Dec 2020 09:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607593311; 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=rGzQjLKz/9VoLf8Q6rWiJFlhECjpsDWxpe3+P63MJFY=; b=f2WAUeQdCIHo46WyfdXgQwTrfUvt2WvkWb9yDI5gNNtZ+uFpAQ2lAZL1VmyeF7UvsiWTAP 9GXVpuj+OyAM+nwQZOTxrDjoesq3D4Qm6OWXNQCxyUArdSxwHXv995Di0dwrkyP/avNZ7w ONPFkIoLgeJjOt8DaTq/3nnMjABwGA8= X-MC-Unique: 8bbAv4BjP3ujzxPrI23rYQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] hyperv: remove duplicit addr check Date: Thu, 10 Dec 2020 10:41:10 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) We already check addr is not negative right after filling its value. There's no need to check it before using it too. Signed-off-by: J=C3=A1n Tomko Fixes: a7a1d1f59e8ba2d8a3ed920ef595ccdfb0d8feb6 Reviewed-by: Michal Privoznik --- src/hyperv/hyperv_driver.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index c2c103aa3b..1200bf02ff 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -561,9 +561,6 @@ hypervDomainDefParsePhysicalDisk(hypervPrivate *priv, driveNumberStr =3D g_strdup_printf("%u", diskdrive->data->DriveNumber); virDomainDiskSetSource(disk, driveNumberStr); =20 - if (addr < 0) - goto cleanup; - if (controller->data->ResourceType =3D=3D MSVM_RASD_RESOURCETYPE_PARAL= LEL_SCSI_HBA) { for (i =3D 0; i < HYPERV_MAX_SCSI_CONTROLLERS; i++) { if (controller =3D=3D scsiControllers[i]) { --=20 2.26.2