diff options
author | Varun Sethi <Varun.Sethi@freescale.com> | 2014-06-24 19:27:15 +0530 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2014-07-07 10:30:01 +0200 |
commit | d033f48f3a4a9279c7475891fbb060d4881c22da (patch) | |
tree | d13c87c87a2e1a30f7ee3d670c3ffdba8b50d17d /drivers/iommu/fsl_pamu_domain.c | |
parent | cd3de83f147601356395b57a8673e9c5ff1e59d1 (diff) |
iommu/fsl: Fix PAMU window size check.
is_power_of_2 requires an unsigned long parameter which would
lead to truncation of 64 bit values on 32 bit architectures.
__ffs also expects an unsigned long parameter thus won't work
for 64 bit values on 32 bit architectures.
Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com>
Tested-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/fsl_pamu_domain.c')
-rw-r--r-- | drivers/iommu/fsl_pamu_domain.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index 93072ba44b1d..3dd0b8edd429 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c @@ -301,7 +301,7 @@ static int check_size(u64 size, dma_addr_t iova) * Size must be a power of two and at least be equal * to PAMU page size. */ - if (!is_power_of_2(size) || size < PAMU_PAGE_SIZE) { + if ((size & (size - 1)) || size < PAMU_PAGE_SIZE) { pr_debug("%s: size too small or not a power of two\n", __func__); return -EINVAL; } |