Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1613984rwd; Thu, 1 Jun 2023 19:29:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5176CPbEh5AQsyqtn0PaiM07fVBLGHk0ccEYyvdaEJo0viPFX0wiwFohutAQSgIaSm4sxD X-Received: by 2002:a05:6a21:797:b0:10f:702a:189b with SMTP id mg23-20020a056a21079700b0010f702a189bmr7533616pzb.24.1685672951345; Thu, 01 Jun 2023 19:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685672951; cv=none; d=google.com; s=arc-20160816; b=W7Mx6WCgEpb5geuEBJBoIHDwZSqvCMMnL+qG6vzd9BsVPn/xprgaIffEI2XNtaTTgb jDjppOE15OcOtBdvTsBzhTgDncPX5NtkNwLANSfgHewGvMBDDU3uA4wjLNGywpI7p4ey yVMy8q/wt4N+aDrYCups21kV5d+Xfc4h7qq8sdkH53J7qfFtLQFh+GCNlsnk2Kn+0n8+ tUkvkbOdXpGe174Y9slrSl9TYo4EoWD8/rqIHxBp3Cd1YA1f6dR8oSmryJ7on6tpDDd+ TF25DrdI1EY5B/JZDEf8AGc16DlEtiF2oqJnRiRPvwgs68+sIgNu1p0lc1NdekvkS2tv s8uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4/rMujaOZaaCbySzKnCuUr4fE9psWIFDWjIJfU1x45c=; b=XxaIr/MAN8jj2eI7y0ORs/F5LWdqzfi9UzSGGAaj97jRxH04VIy7d4p9vwZd5KY072 I2UYOLjCiCX3xoEMrwdj4XMG9edpl/nzbeUwT1cNBKlD3NmhJ4Prrf1iINfxdsDldbKn 8XXNTsxwu+3CGbkJeDsyGCe4V0sKSnaa3+T7Uo2B2pOfCVMPRDDiZtod0JZbeS8ZpZjZ i3TZutlb1M46ASD+G5oDYC+yMzYhooZ08nnk3whtR4azsGjRhGdpa+8WHoUvBWTG9cRz l9yb/kIWr0pOBHH5od56XnkuQgCRQ9A8nkVWqSXo4kfUsc2PNmCQJPpI+0cGnmBS/7nx 7/7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YENGcEbc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j5-20020a170902da8500b001b0179ad15esi120113plx.342.2023.06.01.19.28.58; Thu, 01 Jun 2023 19:29:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YENGcEbc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233315AbjFBCIh (ORCPT + 99 others); Thu, 1 Jun 2023 22:08:37 -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 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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