Re: [PATCH] iommu/arm-smmu-v3: Avoid uninitialized asid in case of error

From: Jason Gunthorpe
Date: Tue Jun 04 2024 - 14:55:38 EST


On Tue, Jun 04, 2024 at 06:52:18PM +0000, Mostafa Saleh wrote:
> 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@xxxxxxxxxx>
> Closes:https://lore.kernel.org/linux-iommu/849e3d77-0a3c-43c4-878d-a0e061c8cd61@moroto.mountain/T/#u
> Signed-off-by: Mostafa Saleh <smostafa@xxxxxxxxxx>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks this TODO is in my pile of emails :\

Fixes: 04905c17f648 ("iommu/arm-smmu-v3: Build the whole CD in arm_smmu_make_s1_cd()")
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

(mind the missing space 'Closes:')

Jason