summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2015-07-01 15:33:03 +0200
committerMarek Szyprowski <m.szyprowski@samsung.com>2015-07-01 15:33:03 +0200
commitadde421ca55ea643ee740e4a2ca1908b74013a45 (patch)
tree28b01c98a4936b3bbb60b7b4ce92f33767f4eeb9
parent2c6e222e3a5133a0c5792832cb85167b32d94bf7 (diff)
downloadlinux-exynos-adde421ca55ea643ee740e4a2ca1908b74013a45.tar.gz
linux-exynos-adde421ca55ea643ee740e4a2ca1908b74013a45.tar.bz2
linux-exynos-adde421ca55ea643ee740e4a2ca1908b74013a45.zip
arm: dma-mapping: fix off-by-one error in bitmap size check
nr_bitmaps member of mapping structure stores the number of already allocated bitmaps and it is interpreted as loop iterator (it starts from 0 not from 1), so a comparison against number of possible bitmap extensions should include this fact. This patch fixes this by changing the extension failure condition. Reported-by: Hyungwon Hwang <human.hwang@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Change-Id: Id929785a802790c9ab8500a50cd2496ab69545eb
-rw-r--r--arch/arm/mm/dma-mapping.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index c27447653903..40c05a8c6fc3 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1919,7 +1919,7 @@ static int extend_iommu_mapping(struct dma_iommu_mapping *mapping)
{
int next_bitmap;
- if (mapping->nr_bitmaps > mapping->extensions)
+ if (mapping->nr_bitmaps >= mapping->extensions)
return -EINVAL;
next_bitmap = mapping->nr_bitmaps;