iommu: io-pgtable-arm: Correctly update *size in map_sg

Currently, in the arm_lpae_map_sg early return path (when neither READ
nor WRITE permissions were specified), we don't store the "partially
mapped" size in the size output parameter, as is expected.  This could
result in someone up the stack using an uninitialized variable.  Fix
this by storing 0 in *size when there's nothing to do.

Change-Id: I3b0952aa5bcc2810843b7c513c32c3d665169e40
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
This commit is contained in:
Mitchel Humpherys 2015-10-22 13:48:29 -07:00 committed by David Keitel
parent b6d3fe2204
commit b47628bf9f

View file

@ -479,7 +479,7 @@ static int arm_lpae_map_sg(struct io_pgtable_ops *ops, unsigned long iova,
/* If no access, then nothing to do */
if (!(iommu_prot & (IOMMU_READ | IOMMU_WRITE)))
return 0;
goto out_err;
prot = arm_lpae_prot_to_pte(data, iommu_prot);