From nobody Sun Apr 28 18:42:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.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=intel.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630347212176620.6277373762816; Mon, 30 Aug 2021 11:13:32 -0700 (PDT) Received: from localhost ([::1]:51242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKlmk-0004wH-RU for importer@patchew.org; Mon, 30 Aug 2021 14:13:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKllb-000463-ML for qemu-devel@nongnu.org; Mon, 30 Aug 2021 14:12:19 -0400 Received: from mga09.intel.com ([134.134.136.24]:30827) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKllY-0002wT-HX for qemu-devel@nongnu.org; Mon, 30 Aug 2021 14:12:19 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2021 11:12:09 -0700 Received: from dongwonk-z390-aorus-ultra-intel-gfx.fm.intel.com ([10.105.129.122]) by orsmga002.jf.intel.com with ESMTP; 30 Aug 2021 11:12:09 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10092"; a="218336125" X-IronPort-AV: E=Sophos;i="5.84,364,1620716400"; d="scan'208";a="218336125" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,364,1620716400"; d="scan'208";a="445814880" From: Dongwon Kim To: qemu-devel@nongnu.org Subject: [PATCH] virtio-gpu: no point of checking res->iov Date: Mon, 30 Aug 2021 10:50:33 -0700 Message-Id: <20210830175033.29233-1-dongwon.kim@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=134.134.136.24; envelope-from=dongwon.kim@intel.com; helo=mga09.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, kraxel@redhat.com, Dongwon Kim Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1630347213380100001 Content-Type: text/plain; charset="utf-8" The code should check the opposite condition of res->iov because it will be= null if virtio_gpu_create_mapping_iov fails and actually this checking is not ev= en required because checking on ret covers all failing cases. Signed-off-by: Dongwon Kim --- hw/display/virtio-gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 990e71fd40..72da5bf500 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -362,7 +362,7 @@ static void virtio_gpu_resource_create_blob(VirtIOGPU *= g, ret =3D virtio_gpu_create_mapping_iov(g, cblob.nr_entries, sizeof(cblo= b), cmd, &res->addrs, &res->iov, &res->iov_cnt); - if (ret !=3D 0 || res->iov) { + if (ret !=3D 0) { cmd->error =3D VIRTIO_GPU_RESP_ERR_UNSPEC; g_free(res); return; --=20 2.20.1