summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShiraz Hashim <shashim@codeaurora.org>2016-02-21 12:45:34 +0530
committerKyle Yan <kyan@codeaurora.org>2016-06-01 15:25:54 -0700
commit9735edbe890b6f09dc74438b81beb37650eaddba (patch)
tree198f43ffc33885df6e3b866432542ff294b69642
parent17505518150ff93d4b29380aa201d98abc707c37 (diff)
arm: dma-mapping: fix data types to hold size_t
size_t type data should not be held under variable of type int, as this can truncate large values especially on a 64bit system. Fix it. Change-Id: I5ad1ab321738772a99920e3fa287bda266cb05ed Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
-rw-r--r--arch/arm/mm/dma-mapping.c4
-rw-r--r--arch/arm64/mm/dma-mapping.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 231cd6a93a63..94d979205c83 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1230,8 +1230,8 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size,
gfp_t gfp, struct dma_attrs *attrs)
{
struct page **pages;
- int count = size >> PAGE_SHIFT;
- int array_size = count * sizeof(struct page *);
+ size_t count = size >> PAGE_SHIFT;
+ size_t array_size = count * sizeof(struct page *);
int i = 0;
if (array_size <= PAGE_SIZE)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 760874c2fb45..c2819df04b3f 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -1207,8 +1207,8 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size,
gfp_t gfp, struct dma_attrs *attrs)
{
struct page **pages;
- int count = size >> PAGE_SHIFT;
- int array_size = count * sizeof(struct page *);
+ size_t count = size >> PAGE_SHIFT;
+ size_t array_size = count * sizeof(struct page *);
int i = 0;
if (array_size <= PAGE_SIZE)
@@ -1398,8 +1398,8 @@ static void *__iommu_alloc_atomic(struct device *dev, size_t size,
{
struct page *page;
struct page **pages;
- int count = size >> PAGE_SHIFT;
- int array_size = count * sizeof(struct page *);
+ size_t count = size >> PAGE_SHIFT;
+ size_t array_size = count * sizeof(struct page *);
int i;
void *addr;