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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 809EFC7EE2A for ; Fri, 2 Jun 2023 02:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233490AbjFBCIj (ORCPT ); Thu, 1 Jun 2023 22:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233416AbjFBCId (ORCPT ); Thu, 1 Jun 2023 22:08:33 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 894B213E for ; Thu, 1 Jun 2023 19:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685671712; x=1717207712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xXDHEebrmcG8OAsrT6tWlvpRC2d/E9PoJjmv8khoEmE=; b=YENGcEbcSYn/b/gmzsxOOzGgI4858rwzERInKA4cVqwGNdsgE9H7Q1Wi Md8UVrO3rxXEAsY0z0sE/poEd5+BVVGrt/I2nn4LcZTKfcsO/Xqm1z/Xt 79UYrjpOKYDqAFeM7RAUsRd1j/ExY0gHrP+aqvqEyWaTBIAOoIoH/rZtp ShwENKS7BhyrSonq/t0PUyGJpA3IMePno93KBHwEpW3NfNcoNhfsBSM2f Kb0XGudfkfy+P1OVtFc9iAtThr1i5UJLe36wPvg2ZFVXwGtJjGyqv3v80 f59CX9Bifh7tARCfBrBUrPTUHU8Sq2prHABpbQJgqnN+XaZ2osZN2MRxJ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="359039385" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="359039385" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2023 19:08:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="777457827" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="777457827" Received: from tower.bj.intel.com ([10.238.157.62]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2023 19:08:24 -0700 From: Yanfei Xu To: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, yanfei.xu@intel.com Subject: [PATCH v2 2/2] iommu/vt-d: Remove two WARN_ON in domain_context_mapping_one() Date: Fri, 2 Jun 2023 10:05:20 +0800 Message-Id: <20230602020520.224465-3-yanfei.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230602020520.224465-1-yanfei.xu@intel.com> References: <20230602020520.224465-1-yanfei.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the WARN_ON(did == 0) as the domain id 0 is reserved and set once the domain_ids is allocated. So iommu_init_domains will never return 0. Remvoe the WARN_ON(!table) as this pointer will be accessed in the following code, if empty "table" really happens, the kernel will report a NULL pointer reference warning at the first place. Signed-off-by: Yanfei Xu --- drivers/iommu/intel/iommu.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index e9188d045609..3953dd69200d 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -1897,8 +1897,6 @@ static int domain_context_mapping_one(struct dmar_domain *domain, struct context_entry *context; int ret; - WARN_ON(did == 0); - if (hw_pass_through && domain_type_is_si(domain)) translation = CONTEXT_TT_PASS_THROUGH; @@ -1944,8 +1942,6 @@ static int domain_context_mapping_one(struct dmar_domain *domain, if (sm_supported(iommu)) { unsigned long pds; - WARN_ON(!table); - /* Setup the PASID DIR pointer: */ pds = context_get_sm_pds(table); context->lo = (u64)virt_to_phys(table->table) | -- 2.34.1