From: Robin Murphy <robin.murphy@arm.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/arm-smmu-v3: fix resource_size check
Date: Thu, 9 Jan 2020 13:23:14 +0000 [thread overview]
Message-ID: <2cd8ed11-56df-b46b-aa21-5ecc0e2e3082@arm.com> (raw)
In-Reply-To: <20191226095056.30256-1-yamada.masahiro@socionext.com>
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;
> }
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
prev parent reply other threads:[~2020-01-09 13:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-26 9:50 [PATCH] iommu/arm-smmu-v3: fix resource_size check Masahiro Yamada
2020-01-09 13:23 ` Robin Murphy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2cd8ed11-56df-b46b-aa21-5ecc0e2e3082@arm.com \
--to=robin.murphy@arm.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox