Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1025961pxk; Fri, 18 Sep 2020 01:37:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyte5IaVuaoW/KjCfplERt8pCIFEdkNH0zQ9QLH7K6ATrUTl6i7cIfyv3UVHY7RxPNMwDaw X-Received: by 2002:aa7:ca17:: with SMTP id y23mr38646593eds.245.1600418265281; Fri, 18 Sep 2020 01:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600418265; cv=none; d=google.com; s=arc-20160816; b=yJI8n1t8AVOPxCWbLmxbtGZYjB0uLYIruOVeaq2mweAO1xHcNlcnzM+w9qnCdqXKSN dt9Z+ElWP7ECUv4FCH+iiAdE/gfh5lkuZGSDZimeQk//yrv4p9U+pu627OcSce/zv1BY i1ky7iADS2y6+X3aiV6Oqt//KaaEC5gnRiEXFSHFJ25/LBfF7w3WvPiGu2wT9vwEoFOB HnXtAUZZiV2Tx+yyIAAZmyMmjMyqWtaxGVeuDKSeD3rNtmktchTQ0vlIczuvtNw3jUWN HrrQtdGSpcWeGJUDUOK5OZVKIVbA+BcleoatEX5ChWeW4eJYe3GzWji8XMzwPoRro4A6 R/mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=htNaUY3L3JDR2d+cuPRlTO96y90KvaE3uVus1+SoYno=; b=HkOaIBm0/0u+MGnkW5cOixT70ARtcCDbpcM79jxFHOqqNhWCKnu0bhuEFW1mJmCg1f +5LjUM244viynKu51mQzd/afY+c2FZFbZ1klUtXOOZqBm63k0n3NpC2/Sp8H3mC1rAsZ mz7A7Z98H97Dlf3ahvnM4sQi9/UMhz4fEhR9bOYQuEe+CLo33pdMyKJfpdSlECnmVCPd Abzn/2D0DhNbbRRB/59hVdur2TjNSJpEkFXs4PfjS+xT/m2F7MVNvVwkwVVTO02dwsON 4gyPTC4T6Z2bq++1r+0G6SP3Qm4IcLeRfIUPaPQATRMY5XyVGZQhw41CACMtVHDq/r0A vmEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si1689982eju.731.2020.09.18.01.37.21; Fri, 18 Sep 2020 01:37:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726301AbgIRIgX (ORCPT + 99 others); Fri, 18 Sep 2020 04:36:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbgIRIgW (ORCPT ); Fri, 18 Sep 2020 04:36:22 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D954C06174A for ; Fri, 18 Sep 2020 01:36:22 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id CE2BF396; Fri, 18 Sep 2020 10:36:19 +0200 (CEST) Date: Fri, 18 Sep 2020 10:36:18 +0200 From: Joerg Roedel To: Joao Martins Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Dan Carpenter , Suravee Suthikulpanit Subject: Re: [PATCH] iommu/amd: Fix potential @entry null deref Message-ID: <20200918083618.GF31590@8bytes.org> References: <20200910171621.12879-1-joao.m.martins@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910171621.12879-1-joao.m.martins@oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 10, 2020 at 06:16:21PM +0100, Joao Martins wrote: > After commit 26e495f34107 ("iommu/amd: Restore IRTE.RemapEn bit after > programming IRTE"), smatch warns: > > drivers/iommu/amd/iommu.c:3870 amd_iommu_deactivate_guest_mode() > warn: variable dereferenced before check 'entry' (see line 3867) > > Fix this by moving the @valid assignment to after @entry has been checked > for NULL. > > Cc: Suravee Suthikulpanit > Fixes: 26e495f34107 ("iommu/amd: Restore IRTE.RemapEn bit after programming IRTE") > Reported-by: Dan Carpenter > Signed-off-by: Joao Martins > --- > drivers/iommu/amd/iommu.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Applied for v5.9, thanks.