Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62a8bc20 authored by Chintan Pandya's avatar Chintan Pandya Committed by Patrick Daly
Browse files

arm64: dma-mapping: use correct type for iova in arm_iommu_unmap_sg



IOMMU virtual addresses use the dma_addr_t type since they can be up to
64-bits.  We're currently using an `unsigned int' to store our IOVA in
arm_iommu_unmap_sg, which could result in truncation.  Use the correct
type for an I/O virtual address: dma_addr_t.

This was previously fixed for arm_iommu_map_sg in
[02454d7f9feeb: "arm64: dma-mapping: use correct type for iova"].

Make the same fix in arm_iommu_unmap_sg.

Change-Id: Ib22a9600f33e6fa155812b08d67d62f72af0ad8e
Signed-off-by: default avatarChintan Pandya <cpandya@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent c256bd48
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1731,7 +1731,7 @@ void arm_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
{
	struct dma_iommu_mapping *mapping = dev->archdata.mapping;
	unsigned int total_length = sg_dma_len(sg);
	unsigned int iova = sg_dma_address(sg);
	dma_addr_t iova = sg_dma_address(sg);

	total_length = PAGE_ALIGN((iova & ~PAGE_MASK) + total_length);
	iova &= PAGE_MASK;