lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20180426044929.16896-1-yuehaibing@huawei.com> Date: Thu, 26 Apr 2018 12:49:29 +0800 From: YueHaibing <yuehaibing@...wei.com> To: <will.deacon@....com>, <robin.murphy@....com>, <joro@...tes.org> CC: <linux-arm-kernel@...ts.infradead.org>, <iommu@...ts.linux-foundation.org>, <linux-kernel@...r.kernel.org>, YueHaibing <yuehaibing@...wei.com> Subject: [PATCH] iommu/io-pgtable-arm: Use for_each_set_bit to simplify code We can use for_each_set_bit() to simplify code slightly in the ARM io-pgtable self tests while unmapping. Signed-off-by: YueHaibing <yuehaibing@...wei.com> --- drivers/iommu/io-pgtable-arm-v7s.c | 5 +---- drivers/iommu/io-pgtable-arm.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index 10e4a3d..50e3a9f 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -898,8 +898,7 @@ static int __init arm_v7s_do_selftests(void) /* Full unmap */ iova = 0; - i = find_first_bit(&cfg.pgsize_bitmap, BITS_PER_LONG); - while (i != BITS_PER_LONG) { + for_each_set_bit(i, &cfg.pgsize_bitmap, BITS_PER_LONG) { size = 1UL << i; if (ops->unmap(ops, iova, size) != size) @@ -916,8 +915,6 @@ static int __init arm_v7s_do_selftests(void) return __FAIL(ops); iova += SZ_16M; - i++; - i = find_next_bit(&cfg.pgsize_bitmap, BITS_PER_LONG, i); } free_io_pgtable_ops(ops); diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index 39c2a05..4ffdd88 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -1120,8 +1120,7 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg) /* Full unmap */ iova = 0; - j = find_first_bit(&cfg->pgsize_bitmap, BITS_PER_LONG); - while (j != BITS_PER_LONG) { + for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) { size = 1UL << j; if (ops->unmap(ops, iova, size) != size) @@ -1138,8 +1137,6 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg) return __FAIL(ops, i); iova += SZ_1G; - j++; - j = find_next_bit(&cfg->pgsize_bitmap, BITS_PER_LONG, j); } free_io_pgtable_ops(ops); -- 2.7.0
Powered by blists - more mailing lists