Commit 00edefae authored by Andi Kleen's avatar Andi Kleen Committed by Andi Kleen

[PATCH] x86-64: Fix off by one error in IOMMU boundary checking

Should be harmless because there is normally no memory there, but
technically it was incorrect.

Pointed out by Leo Duran
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent ffb60175
...@@ -185,7 +185,7 @@ static void iommu_full(struct device *dev, size_t size, int dir) ...@@ -185,7 +185,7 @@ static void iommu_full(struct device *dev, size_t size, int dir)
static inline int need_iommu(struct device *dev, unsigned long addr, size_t size) static inline int need_iommu(struct device *dev, unsigned long addr, size_t size)
{ {
u64 mask = *dev->dma_mask; u64 mask = *dev->dma_mask;
int high = addr + size >= mask; int high = addr + size > mask;
int mmu = high; int mmu = high;
if (force_iommu) if (force_iommu)
mmu = 1; mmu = 1;
...@@ -195,7 +195,7 @@ static inline int need_iommu(struct device *dev, unsigned long addr, size_t size ...@@ -195,7 +195,7 @@ static inline int need_iommu(struct device *dev, unsigned long addr, size_t size
static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t size) static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t size)
{ {
u64 mask = *dev->dma_mask; u64 mask = *dev->dma_mask;
int high = addr + size >= mask; int high = addr + size > mask;
int mmu = high; int mmu = high;
return mmu; return mmu;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment