From nobody Mon Feb 9 05:19:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1573650462; cv=none; d=zoho.com; s=zohoarc; b=mW5fz3ppcZB7NhG8e3tUIvdbGidKdqYyhJnTaM2WWoTlbro8T1Tku49DqIPe7cNBrTh1SiAf33wk3cOfNINYJT1/4JK+2MIzFQBkhNKlIhjndqWUslDLv5oGenqGl8mhiRHLmO/5qLj4uSM8ARk5kugEGVCVzpduo9IE8soXGLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573650462; 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=Jz+olsPTrQGniQSIteNmUpwHJV5L/iaeYiwC4NsT9LU=; b=QlRYYYOD554E69rkviqrNSY7FleSuS/Uc3Wac+mTWWhGRft3cvuwvXVMCKhhn3Q77jHdKvApLE/zVqzL1AftFxNU8L7TkJmsSka2/GGG0Yy0qFpwSkUT+Tyi4uvLAL+/EdbfbE74/2pmE9GHqIVUlYFkPMGtqgp0JjPy6od508w= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 157365046270868.8439973565338; Wed, 13 Nov 2019 05:07:42 -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-176-YoTdRtcxOgOz2sBCvqJMlw-1; Wed, 13 Nov 2019 08:07:35 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 301B3800686; Wed, 13 Nov 2019 13:07:30 +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 00CD5601B8; Wed, 13 Nov 2019 13:07:29 +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 B28C04BB78; Wed, 13 Nov 2019 13:07:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xADD7Hef007090 for ; Wed, 13 Nov 2019 08:07:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8F42B60CCC; Wed, 13 Nov 2019 13:07:17 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 195AC60BE0 for ; Wed, 13 Nov 2019 13:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573650461; 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=Jz+olsPTrQGniQSIteNmUpwHJV5L/iaeYiwC4NsT9LU=; b=B/PnBaFzmUptm8ccQPXwpLFhG6bNvM58GZF+NVpp87rqD6KF/EbGqC1VQ4IPZ1ovsQuLZO N2KvpFPBMcQb7TYQ1twcTzVty1K70IcZn+aVs9ipG2H5QOz6R4RiVOE7PaOTgSuvIedNAa tqtoM9eOPBF9Y2/65ch6K2KKGbWDwrc= From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 13 Nov 2019 14:07:06 +0100 Message-Id: <91824dfdd7b12f42def109955d5ea188dd5c3882.1573649216.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/8] qemu: gpu: Sanitize error values in qemuVhostUserGPUGetPid 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.11 X-MC-Unique: YoTdRtcxOgOz2sBCvqJMlw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The caller doesn't care about the actual return value, so return -1 rather than errno. Signed-off-by: Peter Krempa --- src/qemu/qemu_vhost_user_gpu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_vhost_user_gpu.c b/src/qemu/qemu_vhost_user_gpu.c index 37e424eac3..51244f9b35 100644 --- a/src/qemu/qemu_vhost_user_gpu.c +++ b/src/qemu/qemu_vhost_user_gpu.c @@ -61,7 +61,7 @@ qemuVhostUserGPUCreatePidFilename(const char *stateDir, * @alias: video device alias * @pid: pointer to pid * - * Return -errno upon error, or zero on successful reading of the pidfile. + * Return -1 upon error, or zero on successful reading of the pidfile. * If the PID was not still alive, zero will be returned, and @pid will be * set to -1; */ @@ -74,11 +74,13 @@ qemuVhostUserGPUGetPid(const char *binPath, { g_autofree char *pidfile =3D NULL; - pidfile =3D qemuVhostUserGPUCreatePidFilename(stateDir, shortName, ali= as); - if (!pidfile) - return -ENOMEM; + if (!(pidfile =3D qemuVhostUserGPUCreatePidFilename(stateDir, shortNam= e, alias))) + return -1; + + if (virPidFileReadPathIfAlive(pidfile, pid, binPath) < 0) + return -1; - return virPidFileReadPathIfAlive(pidfile, pid, binPath); + return 0; } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list