summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/fsl_pamu_domain.c
diff options
context:
space:
mode:
authorVarun Sethi <Varun.Sethi@freescale.com>2014-06-24 15:57:15 +0200
committerJoerg Roedel <jroedel@suse.de>2014-07-07 10:30:01 +0200
commitd033f48f3a4a9279c7475891fbb060d4881c22da (patch)
treed13c87c87a2e1a30f7ee3d670c3ffdba8b50d17d /drivers/iommu/fsl_pamu_domain.c
parentLinux 3.16-rc4 (diff)
downloadlinux-d033f48f3a4a9279c7475891fbb060d4881c22da.tar.xz
linux-d033f48f3a4a9279c7475891fbb060d4881c22da.zip
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.c2
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;
}