Skip to content

Commit f9705d6

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/tegra: Fix incorrect size calculation
This driver uses a mixture of ways to get the size of a PTE, tegra_smmu_set_pde() did it as sizeof(*pd) which became wrong when pd switched to a struct tegra_pd. Switch pd back to a u32* in tegra_smmu_set_pde() so the sizeof(*pd) returns 4. Fixes: 50568f8 ("iommu/terga: Do not use struct page as the handle for as->pd memory") Reported-by: Diogo Ivo <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Jason Gunthorpe <[email protected]> Acked-by: Thierry Reding <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Tested-by: Diogo Ivo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 19272b3 commit f9705d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iommu/tegra-smmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,11 @@ static void tegra_smmu_set_pde(struct tegra_smmu_as *as, unsigned long iova,
559559
{
560560
unsigned int pd_index = iova_pd_index(iova);
561561
struct tegra_smmu *smmu = as->smmu;
562-
struct tegra_pd *pd = as->pd;
562+
u32 *pd = &as->pd->val[pd_index];
563563
unsigned long offset = pd_index * sizeof(*pd);
564564

565565
/* Set the page directory entry first */
566-
pd->val[pd_index] = value;
566+
*pd = value;
567567

568568
/* The flush the page directory entry from caches */
569569
dma_sync_single_range_for_device(smmu->dev, as->pd_dma, offset,

0 commit comments

Comments
 (0)