[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230530092503.152926-3-yanfei.xu@intel.com>
Date: Tue, 30 May 2023 17:25:03 +0800
From: Yanfei Xu <yanfei.xu@...el.com>
To: dwmw2@...radead.org, baolu.lu@...ux.intel.com, joro@...tes.org,
will@...nel.org, robin.murphy@....com
Cc: iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
yanfei.xu@...el.com
Subject: [PATCH 2/2] iommu/vt-d: Use BUG_ON to check NULL value of 'table'
Checking NULL value of 'table' variable deserves a BUG_ON as the
following code will trigger a crash by dereferencing the NULL
'table' pointer. Crash in advance with BUG_ON to avoid WARN_ON
plus NULL pointer dereferencing can simplify the crash log.
Signed-off-by: Yanfei Xu <yanfei.xu@...el.com>
---
drivers/iommu/intel/iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index e98f1b122b49..8aa3bfdb7f95 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1944,7 +1944,7 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
if (sm_supported(iommu)) {
unsigned long pds;
- WARN_ON(!table);
+ BUG_ON(!table);
/* Setup the PASID DIR pointer: */
pds = context_get_sm_pds(table);
--
2.34.1
Powered by blists - more mailing lists