From: Vasant Hegde <vasant.hegde@amd.com>
To: Qianqiang Liu <qianqiang.liu@163.com>,
suravee.suthikulpanit@amd.com, will@kernel.org
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: Should the return value of the rlookup_amd_iommu be checked?
Date: Thu, 12 Sep 2024 10:19:53 +0530 [thread overview]
Message-ID: <dd76524b-34d4-4092-bb04-0f7bd45f7c5c@amd.com> (raw)
In-Reply-To: <ZuJxQKseMZjTjqdt@iZbp1asjb3cy8ks0srf007Z>
Hi,
On 9/12/2024 10:12 AM, Qianqiang Liu wrote:
> Hi,
>
> I reviewed the following code:
>
> 1592 void amd_iommu_update_and_flush_device_table(struct protection_domain *domain)
> 1593 {
> 1594 struct iommu_dev_data *dev_data;
> 1595
> 1596 list_for_each_entry(dev_data, &domain->dev_list, list) {
> 1597 struct amd_iommu *iommu = rlookup_amd_iommu(dev_data->dev); <-
> 1598
> 1599 set_dte_entry(iommu, dev_data); <-
> 1600 clone_aliases(iommu, dev_data->dev);
> 1601 }
> 1602
> 1603 list_for_each_entry(dev_data, &domain->dev_list, list)
> 1604 device_flush_dte(dev_data);
> 1605
> 1606 domain_flush_complete(domain);
> 1607 }
>
> The "rlookup_amd_iommu" function may return NULL, and the "set_dte_entry" function
> will call "get_dev_table" which will dereference the NULL pointer.
>
> Is this an issue that may cause panic? Or will "rlookup_amd_iommu" function never
> return NULL?
During init driver will initialize rlookup_table. rlookup_amd_iommu will not
return NULL. So its fine.
-Vasant
next prev parent reply other threads:[~2024-09-12 4:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 4:42 Qianqiang Liu
2024-09-12 4:49 ` Vasant Hegde [this message]
2024-09-12 4:53 ` Qianqiang Liu
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=dd76524b-34d4-4092-bb04-0f7bd45f7c5c@amd.com \
--to=vasant.hegde@amd.com \
--cc=iommu@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=qianqiang.liu@163.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=will@kernel.org \
/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®