From nobody Fri May 3 06:39:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561146228; cv=none; d=zoho.com; s=zohoarc; b=P2nqhpt5QIjpxZy63pgwCDVt3WeWuI/ohKtdYFRAokj4dVkG2uVe5vVe73NoOz8we9rBHz5zasTgJh1vkSNJJijClTaQBEB2ECe7JQAPMsaiNMSU40jUGHKILZ1uKfAQd/03lOXvXQNdma9RwjxxhYMcTwg28Cd6YfgLOvpcJQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561146228; 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:ARC-Authentication-Results; bh=es8Lvu+eTlAbPt8iB0hEN7JPrtN78finlOD8qR7o6RU=; b=Jp306FOhsDi0ASNSW9tnj/aJPAmed2wpX2Jq5UADtR+UrFJP8WevOpHH3ihtOCvsRaXAm1BOudWNa5D5tbMsyITDUYbx9xp9/THvm4xOyvZh7lptVgp2Xr96EhaA3xw4LLzybB7gFl5VWWobe4qRjzaPhz48k25V4Q/JNuCLY2I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561146228019115.61778393167947; Fri, 21 Jun 2019 12:43:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF4DD7E459; Fri, 21 Jun 2019 19:43:45 +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 7FEE860579; Fri, 21 Jun 2019 19:43:45 +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 2E7C51806B18; Fri, 21 Jun 2019 19:43:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5LJhhJG031206 for ; Fri, 21 Jun 2019 15:43:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id B8F7A608D0; Fri, 21 Jun 2019 19:43:43 +0000 (UTC) Received: from unknown04D3B0C4CC7D.redhat.com (ovpn-116-57.phx2.redhat.com [10.3.116.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75434608A7 for ; Fri, 21 Jun 2019 19:43:43 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 21 Jun 2019 15:43:36 -0400 Message-Id: <20190621194337.23158-2-jferlan@redhat.com> In-Reply-To: <20190621194337.23158-1-jferlan@redhat.com> References: <20190621194337.23158-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] cpu_x86: Fix memory leak - virCPUx86GetHost 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Jun 2019 19:43:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit 56b254dcc called virCPUx86DataAdd, but returned -1 directly without calling the virCPUx86DataFree. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Michal Privoznik --- src/cpu/cpu_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 71fc365139..978a60c90a 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2791,7 +2791,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, }; =20 if (virCPUx86DataAdd(cpuData, &item) < 0) - return -1; + goto cleanup; } } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 06:39:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561146228; cv=none; d=zoho.com; s=zohoarc; b=DcGduV/oABAOOp9hek2liYLCOUvCW9TBxSwMkO82gcuDtfx6j3rYD3bsorISsbDfhXIp6YHfVzoTmPF3XGfCrIvEWsDFB5p5OYiXqWMFbv/qScE/fYb3IGj0HHggBwknEod0rbg4tkghIawtftVRrwXwtylg5gSACbwIA9JQy1Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561146228; 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:ARC-Authentication-Results; bh=7Vb1vn/XNpSIqoB5n2zHATQZXoIp0bak3zeuDUdQz+Y=; b=OiNGHgPKvixd9ZV2kwosEIONXDCpmLnv1ueku8SNrEZ1//0fhtcVrMwcc1g4pYWwDADOcPSiL9/Rnblg1nzGrcjv6cMv9uoDmx9052UlyJc3u2Qv3m4OGPO7tlkQP+8ibeoixEs1dT4TsjSVL6qrNAwp2Tk4BZjLyN4QL/aX/j4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561146228330842.5474337207867; Fri, 21 Jun 2019 12:43:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 063D3308AA11; Fri, 21 Jun 2019 19:43:46 +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 8E2D55E1A2; Fri, 21 Jun 2019 19:43:45 +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 3E6151806B19; Fri, 21 Jun 2019 19:43:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5LJhiiU031223 for ; Fri, 21 Jun 2019 15:43:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A9D2608D0; Fri, 21 Jun 2019 19:43:44 +0000 (UTC) Received: from unknown04D3B0C4CC7D.redhat.com (ovpn-116-57.phx2.redhat.com [10.3.116.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE394608A7 for ; Fri, 21 Jun 2019 19:43:43 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 21 Jun 2019 15:43:37 -0400 Message-Id: <20190621194337.23158-3-jferlan@redhat.com> In-Reply-To: <20190621194337.23158-1-jferlan@redhat.com> References: <20190621194337.23158-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] cpu_x86: Handle error in x86DataToCPU when calling x86DataAdd 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 21 Jun 2019 19:43:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit 9c9620af called x86DataAdd without checking for an error, so add the error checking. Found by Coverity Signed-off-by: John Ferlan Reviewed-by: Michal Privoznik --- src/cpu/cpu_x86.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 978a60c90a..55b55da784 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -822,7 +822,8 @@ x86DataToCPU(const virCPUx86Data *data, for (blocker =3D hvModel->blockers; *blocker; blocker++) { if ((feature =3D x86FeatureFind(map, *blocker)) && !x86DataIsSubset(©, &feature->data)) - x86DataAdd(&modelData, &feature->data); + if (x86DataAdd(&modelData, &feature->data) < 0) + goto error; } } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list