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 <pmorel@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Link: https://lore.kernel.org/r/20221025115657.1666860-5-schnelle@linux.ibm.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Niklas Schnelle 2022-10-25 13:56:55 +02:00 committed by Joerg Roedel
parent cbf7827bc5
commit a4d996c2c4
1 changed files with 1 additions and 1 deletions

View File

@ -213,7 +213,7 @@ static int s390_iommu_update_trans(struct s390_domain *s390_domain,
int rc = 0; int rc = 0;
if (dma_addr < s390_domain->domain.geometry.aperture_start || 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; return -EINVAL;
nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;