From nobody Wed May 1 14:32:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559746817; cv=none; d=zoho.com; s=zohoarc; b=WbMV2Oaimicsm9IaqVOsdH1+QgWbyJhvBRa51j2BiEPL5e4fLfeIbS2O00SP4+P/FjwhPEFQijjupZ6BEJq6gQlGKtRmmfyd7T/FIehqlXt1pL531LMrhjgNfvG++C2PEyzs+BVl5KkK6YseMKUw2cxt/yvXCLkO5+PqMT6l+zU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559746817; h=Content-Type:Content-Transfer-Encoding:Cc: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=KQ3y/iPHmqO/aGArcrSW2ux0jSasmzLnBFK/dMHqE+g=; b=dHCMZXqeQvfj8a9nbZ2/nVprlJn/Cyr50pHDxViFWjTwQLTzkKByYhhxfH5gLgCtCi7HC3Q8FjA72nEEwEkD4ImiW/8S3BKcEpqQwa82AxBCT+FoMUvffCz+pRXQea0836A+NR9uKylSMPXEkhAy+TqtKbft3+G/DyZb6HPB5Fo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559746817796184.32521846630766; Wed, 5 Jun 2019 08:00:17 -0700 (PDT) Received: from localhost ([127.0.0.1]:44085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXOf-000132-H6 for importer@patchew.org; Wed, 05 Jun 2019 11:00:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXNI-0000Io-1d for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:58:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYXNG-0002Hv-4h for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:58:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59292) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYXNF-0002Gs-Vr for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:58:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE12D2ED2E1 for ; Wed, 5 Jun 2019 14:58:40 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D2325B68E; Wed, 5 Jun 2019 14:58:40 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 5 Jun 2019 16:58:25 +0200 Message-Id: <20190605145829.7674-2-marcandre.lureau@redhat.com> In-Reply-To: <20190605145829.7674-1-marcandre.lureau@redhat.com> References: <20190605145829.7674-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 05 Jun 2019 14:58:40 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/5] vhost-user-gpu: do not send scanout update if no GPU socket X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Should fix coverity CID 1401760. Signed-off-by: Marc-Andr=C3=A9 Lureau --- contrib/vhost-user-gpu/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/vhost-user-gpu/main.c b/contrib/vhost-user-gpu/main.c index f9e2146b69..9614c9422c 100644 --- a/contrib/vhost-user-gpu/main.c +++ b/contrib/vhost-user-gpu/main.c @@ -354,7 +354,7 @@ vg_disable_scanout(VuGpu *g, int scanout_id) scanout->width =3D 0; scanout->height =3D 0; =20 - { + if (g->sock_fd >=3D 0) { VhostUserGpuMsg msg =3D { .request =3D VHOST_USER_GPU_SCANOUT, .size =3D sizeof(VhostUserGpuScanout), --=20 2.22.0.rc2.384.g1a9a72ea1d From nobody Wed May 1 14:32:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559746976; cv=none; d=zoho.com; s=zohoarc; b=TMnt0jyyTmjuz2+4HCQGHI9EFIlscli30iAqMmXQ3Z1PFcWptTo68B0RjFxQvQQavlRWZh09DBW1Afx6SwYlsVV4O4Bnk9TJNP//3QzvJatpx4KDDWrniHrlj8H0O3/lq7lYn3VOD7N/YASnu0uf2uuZraR1yov1xrjxLeY0+r8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559746976; h=Content-Type:Content-Transfer-Encoding:Cc: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=kQOtEyTq8GnuBv+yuvkIZLiBpgsA0K4B6OSJw0fKauk=; b=PblU9loRQQ/IT1N44jpzCNCu3Hckvpf53phmqIH/hr+Nb+bML8h8CQzCxjZOa32tTM4b6znRwKO4cCiZ6coqNcEXPkZh5iqfGNNEXzYfej1gePC03mEOSJSyIwppwz6cDSIqxbw9eHhll3EWKvbQDTB+GSbptO5k/lmpHLncDE8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559746976627367.54654161896497; Wed, 5 Jun 2019 08:02:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:44139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXRC-0002uV-Ld for importer@patchew.org; Wed, 05 Jun 2019 11:02:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXNI-0000Ip-1b for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:58:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYXNG-0002Hl-28 for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:58:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44214) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYXNF-0002El-TH for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:58:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38264308C383 for ; Wed, 5 Jun 2019 14:58:43 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B6EA5B697; Wed, 5 Jun 2019 14:58:42 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 5 Jun 2019 16:58:26 +0200 Message-Id: <20190605145829.7674-3-marcandre.lureau@redhat.com> In-Reply-To: <20190605145829.7674-1-marcandre.lureau@redhat.com> References: <20190605145829.7674-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 05 Jun 2019 14:58:43 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/5] vhost-user: check unix_listen() return value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This check shouldn't be necessary, since &error_fatal is given as argument and will exit() on failure. However, this change should silence coverity CID 1401761 & 1401705. Signed-off-by: Marc-Andr=C3=A9 Lureau --- contrib/vhost-user-gpu/main.c | 4 ++++ contrib/vhost-user-input/main.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/contrib/vhost-user-gpu/main.c b/contrib/vhost-user-gpu/main.c index 9614c9422c..e0b6df5b4d 100644 --- a/contrib/vhost-user-gpu/main.c +++ b/contrib/vhost-user-gpu/main.c @@ -1160,6 +1160,10 @@ main(int argc, char *argv[]) =20 if (opt_socket_path) { int lsock =3D unix_listen(opt_socket_path, &error_fatal); + if (lsock < 0) { + g_printerr("Failed to listen on %s.\n", opt_socket_path); + exit(EXIT_FAILURE); + } fd =3D accept(lsock, NULL, NULL); close(lsock); } else { diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/mai= n.c index 8d493f598e..8b854117f5 100644 --- a/contrib/vhost-user-input/main.c +++ b/contrib/vhost-user-input/main.c @@ -367,6 +367,10 @@ main(int argc, char *argv[]) =20 if (opt_socket_path) { int lsock =3D unix_listen(opt_socket_path, &error_fatal); + if (lsock < 0) { + g_printerr("Failed to listen on %s.\n", opt_socket_path); + exit(EXIT_FAILURE); + } fd =3D accept(lsock, NULL, NULL); close(lsock); } else { --=20 2.22.0.rc2.384.g1a9a72ea1d From nobody Wed May 1 14:32:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559746968; cv=none; d=zoho.com; s=zohoarc; b=TSKfbdf74Vsdn0OzaJ5mbs/FfhIS9Aecc/sI41k+4HnvSji4Ju7CK/iRBsxLPxq3an/995Iubb9ea/RXh3T7DeqNlvnuFgySfHcCwWAc27y8VTB1+JslBDMg4vjRsDZPHi8WcOOhNZGEvrzKiZ8KYIF95zrog/IWZK+VyMrkexs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559746968; h=Content-Type:Content-Transfer-Encoding:Cc: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=fiwfMFwbrdmnEtAxvxD2cKE7XF6c2pdZiVVQsgGH6fg=; b=CYcG4yehMMAi52gmWEyXqwGw4cPDcyDMyqL2b2zdkNgerwkECQ2xdyRQ3mBnDTwIEDvPpRP14yz/aGodu6E917Eisw2Q2y5RTHNAn5Pi29nGyQo3liAfUdiG5tL6t7FjfyCSjMY7W+8lR2M8byq58Wof6mKGA45CM7p0RQnQxSU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559746968272641.872609404828; Wed, 5 Jun 2019 08:02:48 -0700 (PDT) Received: from localhost ([127.0.0.1]:44137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXR2-0002qL-CE for importer@patchew.org; Wed, 05 Jun 2019 11:02:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXNP-0000OT-TV for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:58:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYXNP-0002Qv-0d for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:58:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57498) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYXNO-0002ON-Ri for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:58:54 -0400 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 D123E30C3196 for ; Wed, 5 Jun 2019 14:58:52 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA723620A0; Wed, 5 Jun 2019 14:58:44 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 5 Jun 2019 16:58:27 +0200 Message-Id: <20190605145829.7674-4-marcandre.lureau@redhat.com> In-Reply-To: <20190605145829.7674-1-marcandre.lureau@redhat.com> References: <20190605145829.7674-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 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.40]); Wed, 05 Jun 2019 14:58:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/5] vhost-user: improve error report X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" g_printerr() needs a trailing \n Signed-off-by: Marc-Andr=C3=A9 Lureau --- contrib/vhost-user-gpu/main.c | 2 +- contrib/vhost-user-input/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/vhost-user-gpu/main.c b/contrib/vhost-user-gpu/main.c index e0b6df5b4d..0ef649ffaa 100644 --- a/contrib/vhost-user-gpu/main.c +++ b/contrib/vhost-user-gpu/main.c @@ -1170,7 +1170,7 @@ main(int argc, char *argv[]) fd =3D opt_fdnum; } if (fd =3D=3D -1) { - g_printerr("Invalid socket"); + g_printerr("Invalid vhost-user socket.\n"); exit(EXIT_FAILURE); } =20 diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/mai= n.c index 8b854117f5..54f882602a 100644 --- a/contrib/vhost-user-input/main.c +++ b/contrib/vhost-user-input/main.c @@ -377,7 +377,7 @@ main(int argc, char *argv[]) fd =3D opt_fdnum; } if (fd =3D=3D -1) { - g_printerr("Invalid socket"); + g_printerr("Invalid vhost-user socket.\n"); exit(EXIT_FAILURE); } vug_init(&vi.dev, fd, vi_panic, &vuiface); --=20 2.22.0.rc2.384.g1a9a72ea1d From nobody Wed May 1 14:32:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559747075; cv=none; d=zoho.com; s=zohoarc; b=Jt6LUVuATJMPme+81wCTWo7SOZpgAHAjq9TC2WBTvnS7nX4CUb03NpSDttFeJBlqq9TJMOyscNb5QIllyo9aINP3MgUNwPq2HQW73ikhWOTEC6HcsQWXPPKOdWutN5Zosec0GlwOeIeSQNOQs95ZzTfgh+q+CVPIzz3z9vTSPX4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559747075; h=Content-Type:Content-Transfer-Encoding:Cc: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=OLpu+QCKSyjpRoK3oJEKuCjHzs9/vEC7YQmk+wP2yGk=; b=Dq7RfAvaAO79IEoryZhJKJSJFQstH73Vmz8zOYaN6r9NfO7hR9++Rv//DHgGfxK6UNKjlzoPlvCz8TJOItsYDw1j+JqG5liZM7bQYSfjVw1I89WbeDzJoxZkeCyvT6kVOOHIpbYX/2lpNW07fQ0H3h9ksVfseS1lkEUxmUUrxjs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559747075237872.6634619522373; Wed, 5 Jun 2019 08:04:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:44156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXSq-0003uA-7p for importer@patchew.org; Wed, 05 Jun 2019 11:04:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXNW-0000U1-Vc for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:59:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYXNW-0002Wl-4W for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:59:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34646) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYXNV-0002WJ-Vq for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:59:02 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 59068300513A for ; Wed, 5 Jun 2019 14:59:01 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56A421018A2C; Wed, 5 Jun 2019 14:58:54 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 5 Jun 2019 16:58:28 +0200 Message-Id: <20190605145829.7674-5-marcandre.lureau@redhat.com> In-Reply-To: <20190605145829.7674-1-marcandre.lureau@redhat.com> References: <20190605145829.7674-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 05 Jun 2019 14:59:01 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 4/5] vhost-user-input: check ioctl(EVIOCGNAME) return value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This should fix coverity CID 1401704. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell --- contrib/vhost-user-input/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/mai= n.c index 54f882602a..8b4e7d2536 100644 --- a/contrib/vhost-user-input/main.c +++ b/contrib/vhost-user-input/main.c @@ -342,7 +342,11 @@ main(int argc, char *argv[]) =20 vi.config =3D g_array_new(false, false, sizeof(virtio_input_config)); memset(&id, 0, sizeof(id)); - ioctl(vi.evdevfd, EVIOCGNAME(sizeof(id.u.string) - 1), id.u.string); + if (ioctl(vi.evdevfd, EVIOCGNAME(sizeof(id.u.string) - 1), + id.u.string) < 0) { + g_printerr("Failed to get evdev name: %s\n", g_strerror(errno)); + exit(EXIT_FAILURE); + } id.select =3D VIRTIO_INPUT_CFG_ID_NAME; id.size =3D strlen(id.u.string); g_array_append_val(vi.config, id); --=20 2.22.0.rc2.384.g1a9a72ea1d From nobody Wed May 1 14:32:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559746874; cv=none; d=zoho.com; s=zohoarc; b=NX72PCLB8+KIuc4D1QopayqTnKd+I4IflSFX8VB9UGWKwNZoFTNyVTzcTfLZRl1TQrEyLS7kr1vVKu4EamgkxSOIeImwwWF6/T7YM7dLQkTkRxDMEBQGfN8OZbm4GVfpHaxZwJ5UbM/d/bZoT2bVeePY13r9NQKlIM/SEqSIQbI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559746874; h=Content-Type:Content-Transfer-Encoding:Cc: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=LET7dk6qUgqpC38CgnsnLz/OHBHTgG9zUuz8MrRmOyI=; b=nVru2aPDHPNVzUZiwcEpCSzs/szehbU0nXearMBDX+uzcbR3++335FF1FM2I8ekKa2gXVHnAyL6z4I3Yf5lR5tiYNowKXPt5oillXMJhkqK8oIqdlxuPmEZcbK1LAduzUuTs4Eol41JREjtX2RJ9AnV3kOuVDF2pxKFDKml+Iy8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559746874719974.7588593260269; Wed, 5 Jun 2019 08:01:14 -0700 (PDT) Received: from localhost ([127.0.0.1]:44121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXPb-0001qv-Ne for importer@patchew.org; Wed, 05 Jun 2019 11:01:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYXNf-0000aw-Oz for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:59:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYXNe-0002gI-PW for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:59:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54042) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYXNe-0002fN-Ju for qemu-devel@nongnu.org; Wed, 05 Jun 2019 10:59:10 -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 mx1.redhat.com (Postfix) with ESMTPS id F049FA3EB3 for ; Wed, 5 Jun 2019 14:59:09 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id C75D11A7D0; Wed, 5 Jun 2019 14:59:02 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 5 Jun 2019 16:58:29 +0200 Message-Id: <20190605145829.7674-6-marcandre.lureau@redhat.com> In-Reply-To: <20190605145829.7674-1-marcandre.lureau@redhat.com> References: <20190605145829.7674-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 05 Jun 2019 14:59:09 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 5/5] vhost-user-gpu: initialize msghdr & iov at declaration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This should fix uninitialized fields found by coverity CID 1401762. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell --- contrib/vhost-user-gpu/main.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/contrib/vhost-user-gpu/main.c b/contrib/vhost-user-gpu/main.c index 0ef649ffaa..04b753046f 100644 --- a/contrib/vhost-user-gpu/main.c +++ b/contrib/vhost-user-gpu/main.c @@ -138,22 +138,20 @@ static int vg_sock_fd_write(int sock, const void *buf, ssize_t buflen, int fd) { ssize_t ret; - struct msghdr msg; - struct iovec iov; + struct iovec iov =3D { + .iov_base =3D (void *)buf, + .iov_len =3D buflen, + }; + struct msghdr msg =3D { + .msg_iov =3D &iov, + .msg_iovlen =3D 1, + }; union { struct cmsghdr cmsghdr; char control[CMSG_SPACE(sizeof(int))]; } cmsgu; struct cmsghdr *cmsg; =20 - iov.iov_base =3D (void *)buf; - iov.iov_len =3D buflen; - - msg.msg_name =3D NULL; - msg.msg_namelen =3D 0; - msg.msg_iov =3D &iov; - msg.msg_iovlen =3D 1; - if (fd !=3D -1) { msg.msg_control =3D cmsgu.control; msg.msg_controllen =3D sizeof(cmsgu.control); @@ -164,9 +162,6 @@ vg_sock_fd_write(int sock, const void *buf, ssize_t buf= len, int fd) cmsg->cmsg_type =3D SCM_RIGHTS; =20 *((int *)CMSG_DATA(cmsg)) =3D fd; - } else { - msg.msg_control =3D NULL; - msg.msg_controllen =3D 0; } =20 do { --=20 2.22.0.rc2.384.g1a9a72ea1d