From nobody Mon Feb 9 00:42:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1673430339; cv=none; d=zohomail.com; s=zohoarc; b=O0eV69MYjJE9YE49X42zo9+UaiVF9wTFGo1eA9CMiKt7Sm/znWq9vOYe481OI15tI8Kf4vYCHKLmZxqR0ZuyfUKkl2rBznjHuDtHzZImCF8pa+dEuiMiIaxm1YY3ViKdP4Yk/nWv8yX50zsQTfVnDA7kYk4gE34aCZgNHacGLnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673430339; 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=F0Y7uav6Dwmcq3FR9ULiG629Cio42Lt8ZNMdMMN8Kek=; b=ETcQr3JOErPOQMS67GMtgJcLtBbPbe89DMnFZMk9rexdkp20NbwB18e5x6b8RVfG+bvCPSHty8vu2iyURyB/ojSbc7BKf6H7nLzRPRoZDjn87H/v1sUstiP3gZ2as/XD+bO6/pQ/yNa3k4Aa8FtEsLVYOLQLniClnGmQWBJecf8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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 [170.10.129.124]) by mx.zohomail.com with SMTPS id 1673430339177353.03493896307566; Wed, 11 Jan 2023 01:45:39 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-QVmoUYChNa-FiAcPy9J2WQ-1; Wed, 11 Jan 2023 04:45:33 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F18D785A588; Wed, 11 Jan 2023 09:45:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A29F7401530E; Wed, 11 Jan 2023 09:45:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6852C194658F; Wed, 11 Jan 2023 09:45:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DB05C1946587 for ; Wed, 11 Jan 2023 09:45:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B50FDC16031; Wed, 11 Jan 2023 09:45:03 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77332C15BA0 for ; Wed, 11 Jan 2023 09:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673430338; 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=F0Y7uav6Dwmcq3FR9ULiG629Cio42Lt8ZNMdMMN8Kek=; b=YQ5yAxDPx2nYGI0T7l2HyVvMjqpBeZwClQDbiZtpVmHJZEJ/w9bJTrSwOr6KmiyI2YEInL gAgriVJb85TPT2mikcV7Uq0dr+efUK944WSx7wh4DOfU3Ydj0zyqTBgEYbD7cVoBPAJRy4 UeekBLmMQvBDnpaTx7d4hV4q6Wp5DkI= X-MC-Unique: QVmoUYChNa-FiAcPy9J2WQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] qemu: Don't check pidfile in qemuPasstStart Date: Wed, 11 Jan 2023 10:44:58 +0100 Message-Id: <09cc85504c59e46f8dd51a10e8ea983bb32cbad7.1673430232.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1673430340683100001 Content-Type: text/plain; charset="utf-8" The pidfile is guaranteed to be non-NULL (thanks to glib allocation functions) and it's dereferenced two lines above anyway. Reported by coverity: /src/qemu/qemu_passt.c: 278 in qemuPasstStart() 272 return 0; 273 274 error: 275 ignore_value(virPidFileReadPathIfLocked(pidfile, &pid)); 276 if (pid !=3D -1) 277 virProcessKillPainfully(pid, true); >>> CID 404360: Null pointer dereferences (REVERSE_INULL) >>> Null-checking "pidfile" suggests that it may be null, but it >>> has already been dereferenced on all paths leading to the check. 278 if (pidfile) 279 unlink(pidfile); 280 281 return -1; Signed-off-by: Jiri Denemark --- src/qemu/qemu_passt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index 3355f7b2fa..5493eee494 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -275,8 +275,7 @@ qemuPasstStart(virDomainObj *vm, ignore_value(virPidFileReadPathIfLocked(pidfile, &pid)); if (pid !=3D -1) virProcessKillPainfully(pid, true); - if (pidfile) - unlink(pidfile); + unlink(pidfile); =20 return -1; } --=20 2.39.0