OSDN Git Service

iommu/arm-smmu-v3: Fix resource_size check
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 26 Dec 2019 09:50:56 +0000 (18:50 +0900)
committerWill Deacon <will@kernel.org>
Fri, 10 Jan 2020 09:49:27 +0000 (09:49 +0000)
This is an off-by-one mistake.

resource_size() returns res->end - res->start + 1.

Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/arm-smmu-v3.c

index a4ee956..5c42c68 100644 (file)
@@ -3632,7 +3632,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
 
        /* Base address */
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (resource_size(res) + 1 < arm_smmu_resource_size(smmu)) {
+       if (resource_size(res) < arm_smmu_resource_size(smmu)) {
                dev_err(dev, "MMIO region too small (%pr)\n", res);
                return -EINVAL;
        }