lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221113133855.6219-1-jundongsong1@gmail.com>
Date:   Sun, 13 Nov 2022 21:38:55 +0800
From:   Harry Song <jundongsong1@...il.com>
To:     will@...nel.org
Cc:     robin.murphy@....com, joro@...tes.org, jundongsong1@...il.com,
        linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: [PATCH] iommu/arm-smmu-v3: Optimize checking for invalid values

Move the check of invalid value (iotlb_gather->pgsize = 0) from
arm_smmu_iotlb_sync() to __arm_smmu_tlb_inv_range() for iotlb sync
to make the code clearer.

Signed-off-by: Harry Song <jundongsong1@...il.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 6d5df91c5..e51b9f506 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -1873,7 +1873,7 @@ static void __arm_smmu_tlb_inv_range(struct arm_smmu_cmdq_ent *cmd,
 	size_t inv_range = granule;
 	struct arm_smmu_cmdq_batch cmds;
 
-	if (!size)
+	if (!size || !inv_range)
 		return;
 
 	if (smmu->features & ARM_SMMU_FEAT_RANGE_INV) {
@@ -2507,9 +2507,6 @@ static void arm_smmu_iotlb_sync(struct iommu_domain *domain,
 {
 	struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
 
-	if (!gather->pgsize)
-		return;
-
 	arm_smmu_tlb_inv_range_domain(gather->start,
 				      gather->end - gather->start + 1,
 				      gather->pgsize, true, smmu_domain);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ