* [PATCH] iommu/arm-smmu-v3: fix resource_size check
@ 2019-12-26 9:50 Masahiro Yamada
2020-01-09 13:23 ` Robin Murphy
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2019-12-26 9:50 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, linux-arm-kernel, Joerg Roedel, iommu
Cc: Masahiro Yamada, linux-kernel
This is an off-by-one mistake.
resource_size() returns res->end - res->start + 1.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/iommu/arm-smmu-v3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index d9e0d9c19b4f..b463599559d2 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -3599,7 +3599,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;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iommu/arm-smmu-v3: fix resource_size check
2019-12-26 9:50 [PATCH] iommu/arm-smmu-v3: fix resource_size check Masahiro Yamada
@ 2020-01-09 13:23 ` Robin Murphy
0 siblings, 0 replies; 2+ messages in thread
From: Robin Murphy @ 2020-01-09 13:23 UTC (permalink / raw)
To: Masahiro Yamada, Will Deacon, linux-arm-kernel, Joerg Roedel, iommu
Cc: linux-kernel
On 26/12/2019 9:50 am, Masahiro Yamada wrote:
> This is an off-by-one mistake.
>
> resource_size() returns res->end - res->start + 1.
Heh, despite the optimism of "Avoid one-off errors by introducing a
resource_size() function", life finds a way...
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> drivers/iommu/arm-smmu-v3.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> index d9e0d9c19b4f..b463599559d2 100644
> --- a/drivers/iommu/arm-smmu-v3.c
> +++ b/drivers/iommu/arm-smmu-v3.c
> @@ -3599,7 +3599,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;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-09 13:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-26 9:50 [PATCH] iommu/arm-smmu-v3: fix resource_size check Masahiro Yamada
2020-01-09 13:23 ` Robin Murphy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).