From: Mario Limonciello <mario.limonciello@amd.com>
To: Antonio Quartulli <antonio@mandelbit.com>,
alexander.deucher@amd.com, christian.koenig@amd.com,
Xinhui.Pan@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] amdgpu: prevent NULL pointer dereference if ATIF is not supported
Date: Thu, 31 Oct 2024 14:37:19 -0500 [thread overview]
Message-ID: <00e9b1f0-7bc1-418c-8e67-e8f1893be665@amd.com> (raw)
In-Reply-To: <20241031152848.4716-1-antonio@mandelbit.com>
On 10/31/2024 10:28, Antonio Quartulli wrote:
> acpi_evaluate_object() may return AE_NOT_FOUND (failure), which
> would result in dereferencing buffer.pointer (obj) while being NULL.
>
> Although this case may be unrealistic for the current code, it is
> still better to protect against possible bugs.
>
> Bail out also when status is AE_NOT_FOUND.
>
> This fixes 1 FORWARD_NULL issue reported by Coverity
> Report: CID 1600951: Null pointer dereferences (FORWARD_NULL)
>
> Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Can you please dig up the right Fixes: tag?
Besides that, LGTM.
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index cce85389427f..b8d4e07d2043 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -172,8 +172,8 @@ static union acpi_object *amdgpu_atif_call(struct amdgpu_atif *atif,
> &buffer);
> obj = (union acpi_object *)buffer.pointer;
>
> - /* Fail if calling the method fails and ATIF is supported */
> - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
> + /* Fail if calling the method fails */
> + if (ACPI_FAILURE(status)) {
> DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n",
> acpi_format_exception(status));
> kfree(obj);
next prev parent reply other threads:[~2024-10-31 19:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 15:28 Antonio Quartulli
2024-10-31 15:48 ` Markus Elfring
2024-10-31 19:37 ` Mario Limonciello [this message]
2024-10-31 20:50 ` Antonio Quartulli
2024-11-01 16:22 ` Mario Limonciello
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=00e9b1f0-7bc1-418c-8e67-e8f1893be665@amd.com \
--to=mario.limonciello@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=antonio@mandelbit.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.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®