diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-07-27 11:12:50 -0400 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-07-30 06:25:45 -0400 |
commit | 9fa8af91f0679f2abbebe1382b937264f3a8b981 (patch) | |
tree | ad23ecfd24dce5f64b151804d6308413b17257f8 /arch/arm | |
parent | 50262a4bf38dd70486e9fce2b8235d5ae3e0f627 (diff) |
ARM: dma-mapping: fix error path for memory allocation failure
This patch fixes incorrect check in error path. When the allocation of
first page fails, the kernel ops appears due to accessing -1 element of
the pages array.
Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index a2881c98fb03..cbdeaf4a3392 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -961,7 +961,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, gfp_t | |||
961 | 961 | ||
962 | return pages; | 962 | return pages; |
963 | error: | 963 | error: |
964 | while (--i) | 964 | while (i--) |
965 | if (pages[i]) | 965 | if (pages[i]) |
966 | __free_pages(pages[i], 0); | 966 | __free_pages(pages[i], 0); |
967 | if (array_size <= PAGE_SIZE) | 967 | if (array_size <= PAGE_SIZE) |