From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Jiawei Gu <Jiawei.Gu@amd.com>, amd-gfx@lists.freedesktop.org
Cc: emily.deng@amd.com
Subject: Re: [PATCH] drm/amdgpu: fix potential NULL pointer when check_atom_bios() fails
Date: Sun, 3 Jan 2021 17:10:49 +0100 [thread overview]
Message-ID: <8f624104-d074-9d92-7d6c-bb28d7f4ea78@gmail.com> (raw)
In-Reply-To: <20201231084741.11865-1-Jiawei.Gu@amd.com>
Am 31.12.20 um 09:47 schrieb Jiawei Gu:
> Asic funcs pointer needs being checked whether is NULL. Because when
> check_atom_bios() fails in req_init_data handshake, asic funcs pointer
> is not initialized yet.
Mhm, I'm wondering if we shouldn't change the init sequence then. The
asic_funcs is something pretty fundamental.
> Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com> for now.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> index 6333cada1e09..efdf639f6593 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> @@ -155,7 +155,7 @@ static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev)
> u8 header[AMD_VBIOS_SIGNATURE_END+1] = {0};
> int len;
>
> - if (!adev->asic_funcs->read_bios_from_rom)
> + if (!adev->asic_funcs || !adev->asic_funcs->read_bios_from_rom)
> return false;
>
> /* validate VBIOS signature */
> @@ -348,7 +348,8 @@ static bool amdgpu_read_disabled_bios(struct amdgpu_device *adev)
> if (adev->flags & AMD_IS_APU)
> return igp_read_bios_from_vram(adev);
> else
> - return amdgpu_asic_read_disabled_bios(adev);
> + return (!adev->asic_funcs || !adev->asic_funcs->read_disabled_bios) ?
> + false : amdgpu_asic_read_disabled_bios(adev);
> }
>
> #ifdef CONFIG_ACPI
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
prev parent reply other threads:[~2021-01-03 16:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-31 8:47 [PATCH] drm/amdgpu: fix potential NULL pointer when check_atom_bios() fails Jiawei Gu
2021-01-03 16:10 ` Christian König [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=8f624104-d074-9d92-7d6c-bb28d7f4ea78@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Jiawei.Gu@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=emily.deng@amd.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