From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 098ACC4338F for ; Wed, 25 Aug 2021 11:56:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 799BC6109E for ; Wed, 25 Aug 2021 11:56:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 799BC6109E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=irrelevant.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:55520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIrWG-0008Dz-SK for qemu-devel@archiver.kernel.org; Wed, 25 Aug 2021 07:56:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIrTJ-00055G-G2; Wed, 25 Aug 2021 07:53:33 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:38509) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIrTH-000098-G4; Wed, 25 Aug 2021 07:53:33 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 59A353200AEA; Wed, 25 Aug 2021 07:53:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 25 Aug 2021 07:53:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=EJm988SYFdU7OrrAE0/4fp8OyhJ el03zvBNXIJzVi7M=; b=PSmoJNOv7jaTxTN2/l/Vp2oEdoB7Z3ojVxdYTf1MCHK jOPWGkYJf4CsEKZnQjUHO3PThTuMMNAUZUwJkyCtd7S7Fk/lHK5VcAz6NjMH8zss p/HTDvO3tTdSzFw1Y3rmQdzC1iVSO9Md7Q6gNH09iCbsM19nxUN1tCnoX5xbn8Ib R8kv+mFzv55EsHtCDZktJ3JDCj9klqO10BKQpIrPS0VavouLZhKo+74+jkFWjpIh gD5xX+gVhlDOBg8qU3fi1VP5IVxdObAIwY1vMPDsRNW3nmWF7ob2d4A8APnZzJan AR2s0JNKVH/wqJOO5hzVtCPTcA0ZIKvBU9yiRxolFqw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=EJm988 SYFdU7OrrAE0/4fp8OyhJel03zvBNXIJzVi7M=; b=cbISKXQZh/oy1kGUpA3xB+ 89ntxxKScELHp3A0s8awcou+EoiTKA93ZYEWdreqfugaAhx/a/EUc+TfMXn3J06/ 58uGW1xmRHSIdHiBi9CD72vfoq3CCFEVvhOlrf21TnuarisuJ7pSNST/+nIUGoe4 RKTPQs5qF1fn0CSKwSF7PgijnADPbOtUc2VewxwGx7t0N0rrZtuQnDSJjltPPopo 1sZdrIGr996QnA/dh0BeG+2FaRAzdulzhds4HJ5MwmHeetvvLLlPa6sGS0E7cx0f 9wsuXseiFoPDHp7TwktXfjtdrReAONa05NnHpr0q1GOPn1eEqIpDPE+UJZ0P2TnQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddtledggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeejgeduffeuieetkeeileekvdeuleetveejudeileduffefjeegfffhuddvudff keenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehith hssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 25 Aug 2021 07:53:24 -0400 (EDT) Date: Wed, 25 Aug 2021 13:53:22 +0200 From: Klaus Jensen To: Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Subject: Re: [PATCH 5/9] util/vfio-helpers: Remove unreachable code in qemu_vfio_dma_map() Message-ID: References: <20210824141142.1165291-1-philmd@redhat.com> <20210824141142.1165291-6-philmd@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3W+JVKLuc52rwbM/" Content-Disposition: inline In-Reply-To: <20210824141142.1165291-6-philmd@redhat.com> Received-SPF: pass client-ip=64.147.123.21; envelope-from=its@irrelevant.dk; helo=wout5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, qemu-devel@nongnu.org, Auger Eric , Hanna Reitz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --3W+JVKLuc52rwbM/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Aug 24 16:11, Philippe Mathieu-Daud=C3=A9 wrote: > qemu_vfio_add_mapping() returns a pointer to an indexed entry > in pre-allocated QEMUVFIOState::mappings[], thus can not be NULL. > Remove the pointless check. >=20 > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > --- > util/vfio-helpers.c | 4 ---- > 1 file changed, 4 deletions(-) >=20 > diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c > index d956866b4e9..e7909222cfd 100644 > --- a/util/vfio-helpers.c > +++ b/util/vfio-helpers.c > @@ -751,10 +751,6 @@ int qemu_vfio_dma_map(QEMUVFIOState *s, void *host, = size_t size, > } > =20 > mapping =3D qemu_vfio_add_mapping(s, host, size, index + 1, = iova0); > - if (!mapping) { > - ret =3D -ENOMEM; > - goto out; > - } > assert(qemu_vfio_verify_mappings(s)); > ret =3D qemu_vfio_do_mapping(s, host, size, iova0); > if (ret) { > --=20 > 2.31.1 >=20 >=20 This looks OK. But maybe it would be prudent to assert that index is within bounds of s->mappings in qemu_vfio_add_mapping? E.g., assert(index >=3D 0 && index < s->nr_mappings + 1); --3W+JVKLuc52rwbM/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmEmLzEACgkQTeGvMW1P DemW4Af7BAFbnmuRcIbgMzqh4na1ONEaNF0+JxbU9IpaqhJ1uKcxIFNHjrDt4jK+ ReS+EohXRyvixBcZ+Uu7Oz2PxNP6sfxg4fjQE/SJBxMn8jk0yDSmj49p5iMsJs5I Y3xPVLHlcvXoG6fgV4esTLncCeVZI1NlR7mbBHSU4WdYWj/+q0tArb4eJ9zXtec0 ZnDfxO9KcXlVqzQGKgAQFPirdDuSA3chF0bN0rz+PNe8YblK3lsA7K8zj1nZzPme PPxrJ7SwgwNrIp32wehrSF9aOd6IdoRdJYEeAgirdBbSj/aC3FQhrTYMUxwbn9LV BNGtYhxTCerQCWNiSjLJi41B3bd+Qw== =RffN -----END PGP SIGNATURE----- --3W+JVKLuc52rwbM/--