From: "Liu, Shaoyun" <Shaoyun.Liu@amd.com>
To: Colin King <colin.king@canonical.com>,
Oded Gabbay <oded.gabbay@gmail.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>,
"Zhou, David(ChunMing)" <David1.Zhou@amd.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amdkfd: fix potential null pointer dereference on pointer peer_dev
Date: Tue, 2 Jul 2019 15:29:27 +0000 [thread overview]
Message-ID: <66e161b2-dc6e-f8e1-c1f4-dbd15e06040a@amd.com> (raw)
In-Reply-To: <20190629133114.14271-1-colin.king@canonical.com>
From the comments , "we will loop GPUs that already be processed (with
lower value of proximity_domain) ", the device should already been
added into the topology_device_list. So in this case ,
kfd_topology_device_by_proximity_domain will not return a NULL pointer.
If you really get the null pointer dereferences here , we must have
some bigger problem and can not solved by added the null check here.
Regards
shaoyun.liu
On 2019-06-29 9:31 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The call to kfd_topology_device_by_proximity_domain can return a NULL
> pointer so add a null pointer check on peer_dev to the existing null
> pointer check on peer_dev->gpu to avoid any potential null pointer
> dereferences.
>
> Addresses-Coverity: ("Dereference on null return value")
> Fixes: ae9a25aea7f3 ("drm/amdkfd: Generate xGMI direct iolink")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> index 4e3fc284f6ac..cb6b46cfa6c2 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> @@ -1293,7 +1293,7 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,
> if (kdev->hive_id) {
> for (nid = 0; nid < proximity_domain; ++nid) {
> peer_dev = kfd_topology_device_by_proximity_domain(nid);
> - if (!peer_dev->gpu)
> + if (!peer_dev || !peer_dev->gpu)
> continue;
> if (peer_dev->gpu->hive_id != kdev->hive_id)
> continue;
next prev parent reply other threads:[~2019-07-02 15:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-29 13:31 Colin King
2019-07-02 15:29 ` Liu, Shaoyun [this message]
2019-07-02 18:24 ` Kuehling, Felix
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=66e161b2-dc6e-f8e1-c1f4-dbd15e06040a@amd.com \
--to=shaoyun.liu@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=David1.Zhou@amd.com \
--cc=airlied@linux.ie \
--cc=amd-gfx@lists.freedesktop.org \
--cc=colin.king@canonical.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oded.gabbay@gmail.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®