[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240604185218.2602058-1-smostafa@google.com>
Date: Tue, 4 Jun 2024 18:52:18 +0000
From: Mostafa Saleh <smostafa@...gle.com>
To: will@...nel.org, robin.murphy@....com,
linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev
Cc: linux-kernel@...r.kernel.org, joro@...tes.org, jgg@...dia.com,
nicolinc@...dia.com, mshavit@...gle.com, Mostafa Saleh <smostafa@...gle.com>,
Dan Carpenter <dan.carpenter@...aro.org>
Subject: [PATCH] iommu/arm-smmu-v3: Avoid uninitialized asid in case of error
Static checker is complaining about the ASID possibly set uninitialized.
This only happens in case of error and this value would be ignored anyway.
A simple fix would be just to initialize the local variable to zero,
this path will only be reached on the first attach to a domain where
the CD is already initialized to zero.
This avoids having to bloat the function with an error path.
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes:https://lore.kernel.org/linux-iommu/849e3d77-0a3c-43c4-878d-a0e061c8cd61@moroto.mountain/T/#u
Signed-off-by: Mostafa Saleh <smostafa@...gle.com>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 ab415e107054..f456bcf1890b 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2302,7 +2302,7 @@ static int arm_smmu_domain_finalise_s1(struct arm_smmu_device *smmu,
struct arm_smmu_domain *smmu_domain)
{
int ret;
- u32 asid;
+ u32 asid = 0;
struct arm_smmu_ctx_desc *cd = &smmu_domain->cd;
refcount_set(&cd->refs, 1);
--
2.45.1.288.g0e0cd299f1-goog
Powered by blists - more mailing lists