From: Robin Murphy <robin.murphy@arm.com>
To: Yu Kuai <yukuai3@huawei.com>,
joro@8bytes.org, mripard@kernel.org, wens@csie.org
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, yi.zhang@huawei.com
Subject: Re: [PATCH] iommu/sun50i: check return value of of_find_device_by_node() in sun50i_iommu_of_xlate()
Date: Thu, 29 Oct 2020 10:21:19 +0000 [thread overview]
Message-ID: <2c2669d1-7f19-5be4-b6df-7cf896015336@arm.com> (raw)
In-Reply-To: <20201029092244.900564-1-yukuai3@huawei.com>
On 2020-10-29 09:22, Yu Kuai wrote:
> If of_find_device_by_node() failed in sun50i_iommu_of_xlate(), null
> pointer dereference will be triggered. Thus return error code if
> of_find_device_by_node() failed.
Again, by what means can that ever actually happen?
Robin.
> Fixes: 4100b8c229b3("iommu: Add Allwinner H6 IOMMU driver")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> drivers/iommu/sun50i-iommu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
> index ea6db1341916..ce94ffa15215 100644
> --- a/drivers/iommu/sun50i-iommu.c
> +++ b/drivers/iommu/sun50i-iommu.c
> @@ -764,6 +764,9 @@ static int sun50i_iommu_of_xlate(struct device *dev,
> struct platform_device *iommu_pdev = of_find_device_by_node(args->np);
> unsigned id = args->args[0];
>
> + if (!iommu_pdev)
> + return -ENODEV;
> +
> dev_iommu_priv_set(dev, platform_get_drvdata(iommu_pdev));
>
> return iommu_fwspec_add_ids(dev, &id, 1);
>
prev parent reply other threads:[~2020-10-29 10:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 9:22 Yu Kuai
2020-10-29 9:25 ` Maxime Ripard
2020-10-29 10:21 ` 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=2c2669d1-7f19-5be4-b6df-7cf896015336@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=mripard@kernel.org \
--cc=wens@csie.org \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.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
all inboxes | Powered by JetHome®