From nobody Mon Feb 9 13:53:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=swemel.ru ARC-Seal: i=1; a=rsa-sha256; t=1696928223; cv=none; d=zohomail.com; s=zohoarc; b=hXAlC/0XpJYN3xQ+DG6tOH9KlWoMbHXilk3q/f9ZTHPBi1D4wQN2n2OQwTe7wui8udjzxHzGu97I1KeDcBkmzz0tcMZobvZNx6W5sXpXZtdvrBqpoh6VgNv0eNIcDlbXRQp9kVAlH1/QG6TtdybbNMYiIdQuErS3Gkgy87haN9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696928223; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=e5OtCdZkP9W1CtAyIO+TwbTymRgJHWirIjGJp4w+gb0=; b=Hs1JtGPC87tyqSyaQMraXJ0NTZsAUCQdCjFBALd2b5GfhRoPRCa30nay/hioHmY+CE76UA4yJJyE+mgwKXbYjP63jbqtDtR7RHZh+ub8f+5MfI2SuoReXjEcuWXaSBwjSVYt1fG0OtQQ54Dhat7fnHCsIVge9Gozie4kK+3DlPw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1696928223222969.2715866171907; Tue, 10 Oct 2023 01:57:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-248-ofO-G5shPFyGrt5KsW9bfA-1; Tue, 10 Oct 2023 04:56:19 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 86B8A2999B2B; Tue, 10 Oct 2023 08:56:16 +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 0938540C6EA8; Tue, 10 Oct 2023 08:56:16 +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 9F10819465B8; Tue, 10 Oct 2023 08:56:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 904DB19465B6 for ; Tue, 10 Oct 2023 08:56:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6CD5A40C6EA8; Tue, 10 Oct 2023 08:56:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65B7140C6EBF for ; Tue, 10 Oct 2023 08:56:14 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-inbound-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35D6D805BAC for ; Tue, 10 Oct 2023 08:56:14 +0000 (UTC) Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-347-s5Efz-QUOnWaWq-Xr6QGrA-1; Tue, 10 Oct 2023 04:56:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696928222; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=e5OtCdZkP9W1CtAyIO+TwbTymRgJHWirIjGJp4w+gb0=; b=Hb0+Cv50Ab0exU/29Sk2PTw/O38GSgQrcd70DCEMjWqkecYaUmnjKETha4abvbCWvr0ZbE JlpRqORg00JWBpw1I5e4hl3y3+WmKOybMWFmzLo4b1AGrf78Oa+ZQ70/X0iSeOu6DaHyfh aM7JMQRTzzza4RPtGgYV02iD3erDbzU= X-MC-Unique: ofO-G5shPFyGrt5KsW9bfA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: s5Efz-QUOnWaWq-Xr6QGrA-1 From: Dmitry Frolov To: libvir-list@redhat.com Subject: [PATCH v1] util: vircommand: fix redundant if Date: Tue, 10 Oct 2023 11:54:14 +0300 Message-Id: <20231010085413.553063-1-frolov@swemel.ru> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: , Cc: Dmitry Frolov 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: swemel.ru Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696928225695100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Comparisson "if(ret =3D=3D -1)" is always false. This statement was forgotten during switching to g_new0() Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 0275b06a55fc7b1ec6a9e93f7fb73bea7388f634 ("util: command: use g_new0= ") Signed-off-by: Dmitry Frolov --- src/util/vircommand.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 9d4ba1e97c..81e74deee0 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2227,7 +2227,7 @@ virCommandProcessIO(virCommand *cmd) int outfd =3D -1, errfd =3D -1; size_t inlen =3D 0, outlen =3D 0, errlen =3D 0; size_t inoff =3D 0; - int ret =3D 0; + int ret =3D -1; g_autofree struct pollfd *fds =3D NULL; =20 if (dryRunBuffer || dryRunCallback) { @@ -2254,9 +2254,6 @@ virCommandProcessIO(virCommand *cmd) VIR_FREE(*cmd->errbuf); *cmd->errbuf =3D g_new0(char, 1); } - if (ret =3D=3D -1) - goto cleanup; - ret =3D -1; =20 fds =3D g_new0(struct pollfd, 3 + virCommandGetNumSendBuffers(cmd)); =20 --=20 2.34.1