From nobody Sat Feb 7 21:05:35 2026 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 9CE2EEB64D8 for ; Wed, 14 Jun 2023 02:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242474AbjFNCtN (ORCPT ); Tue, 13 Jun 2023 22:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242356AbjFNCst (ORCPT ); Tue, 13 Jun 2023 22:48:49 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CA1B2112 for ; Tue, 13 Jun 2023 19:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686710900; x=1718246900; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WrDuSdB9iYumVVBXtypeizwCzmEr0vrCm5Dy+N+kwxM=; b=lgqSQ/Nq5pVoN7RZymWTRPB3e6GlTrC65cBoX81IJlXvgQbYKxSS1+Sn 7BCapw+C+o0ICOsvSJnN7MKRU/GtmvzMvA3vKCjEeUgaeyrHzuZ+8jHIN M8/xMgwy2BOfKQPDfUNjHQruTbLfY9H7cOblWrDvirDWdK6TZXekw3M22 N3k/jHpvEpZ7N3tbrzYkTkHFTDZ1Rw2vqFxlp/y7Io9jrRjE4FoH3fgU9 KdSho4jdRciYB33hx4EGLp3fb0GeA9spqa0EKrZ1UIzfSY+LgFc0ez9AC VugGJcNmnTuUPMn4s/1AolL3m7FkHHnhWmQCGOMGY+2w/5qexVx0X4Xed g==; X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="348164462" X-IronPort-AV: E=Sophos;i="6.00,241,1681196400"; d="scan'208";a="348164462" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 19:48:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="711884211" X-IronPort-AV: E=Sophos;i="6.00,241,1681196400"; d="scan'208";a="711884211" Received: from allen-box.sh.intel.com ([10.239.159.127]) by orsmga002.jf.intel.com with ESMTP; 13 Jun 2023 19:48:18 -0700 From: Lu Baolu To: Joerg Roedel Cc: Yanfei Xu , Suhui , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] iommu/vt-d: Remove two WARN_ON in domain_context_mapping_one() Date: Wed, 14 Jun 2023 10:47:04 +0800 Message-Id: <20230614024705.88878-4-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614024705.88878-1-baolu.lu@linux.intel.com> References: <20230614024705.88878-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yanfei Xu Remove the WARN_ON(did =3D=3D 0) as the domain id 0 is reserved and set once the domain_ids is allocated. So iommu_init_domains will never return 0. Remove 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 Link: https://lore.kernel.org/r/20230605112659.308981-3-yanfei.xu@intel.com Signed-off-by: Lu Baolu --- 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 e83fe243680b..4c0b7424c45e 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_dom= ain *domain, struct context_entry *context; int ret; =20 - WARN_ON(did =3D=3D 0); - if (hw_pass_through && domain_type_is_si(domain)) translation =3D CONTEXT_TT_PASS_THROUGH; =20 @@ -1944,8 +1942,6 @@ static int domain_context_mapping_one(struct dmar_dom= ain *domain, if (sm_supported(iommu)) { unsigned long pds; =20 - WARN_ON(!table); - /* Setup the PASID DIR pointer: */ pds =3D context_get_sm_pds(table); context->lo =3D (u64)virt_to_phys(table->table) | --=20 2.34.1