aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Schnelle <[email protected]>2022-10-25 13:56:55 +0200
committerJoerg Roedel <[email protected]>2022-11-03 15:40:54 +0100
commita4d996c2c4b55a42b21d0f7026b2bd6f7396f666 (patch)
treef560a74306af84087997bfe3ec27fc3da9b7a4e1
parentcbf7827bc5dcfa4301aaea6f57eba9a94dbee7b1 (diff)
iommu/s390: Fix incorrect aperture check
The domain->geometry.aperture_end specifies the last valid address treat it as such when checking if a DMA address is valid. Reviewed-by: Pierre Morel <[email protected]> Reviewed-by: Matthew Rosato <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Niklas Schnelle <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
-rw-r--r--drivers/iommu/s390-iommu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
index 9b3adc61005c..3e601ca6ee0f 100644
--- a/drivers/iommu/s390-iommu.c
+++ b/drivers/iommu/s390-iommu.c
@@ -213,7 +213,7 @@ static int s390_iommu_update_trans(struct s390_domain *s390_domain,
int rc = 0;
if (dma_addr < s390_domain->domain.geometry.aperture_start ||
- dma_addr + size > s390_domain->domain.geometry.aperture_end)
+ (dma_addr + size - 1) > s390_domain->domain.geometry.aperture_end)
return -EINVAL;
nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;