From: "Wang, Yang(Kevin)" <KevinYang.Wang@amd.com>
To: "Ma, Jun" <Jun.Ma2@amd.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Feng, Kenneth" <Kenneth.Feng@amd.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>
Subject: RE: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle
Date: Mon, 13 May 2024 23:13:58 +0000 [thread overview]
Message-ID: <PH7PR12MB5997912FE549D642FE2AEE5782E22@PH7PR12MB5997.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20240513085616.584249-3-Jun.Ma2@amd.com>
[AMD Official Use Only - AMD Internal Distribution Only]
-----Original Message-----
From: Ma, Jun <Jun.Ma2@amd.com>
Sent: Monday, May 13, 2024 4:56 PM
To: amd-gfx@lists.freedesktop.org
Cc: Feng, Kenneth <Kenneth.Feng@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Wang, Yang(Kevin) <KevinYang.Wang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Ma, Jun <Jun.Ma2@amd.com>
Subject: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle
Check handle pointer before using it
Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c
index 28febf33fb1b..e969a7d77b4d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c
@@ -279,7 +279,7 @@ static struct aca_bank_error *get_bank_error(struct aca_error *aerr, struct aca_ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_info *info,
enum aca_error_type type, u64 count) {
- struct aca_error_cache *error_cache = &handle->error_cache;
+ struct aca_error_cache *error_cache;
struct aca_bank_error *bank_error;
struct aca_error *aerr;
@@ -289,6 +289,10 @@ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_in
if (!count)
return 0;
+ error_cache = &handle->error_cache;
[Kevin]:
The above code is always return non-0 value, right?
Best Regards,
Kevin
+ if (!error_cache)
+ return -EINVAL;
+
aerr = &error_cache->errors[type];
bank_error = get_bank_error(aerr, info);
if (!bank_error)
--
2.34.1
next prev parent reply other threads:[~2024-05-13 23:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 8:56 [PATCH 1/5] drm/amdgpu/pm: Fix the null pointer dereference for smu7 Ma Jun
2024-05-13 8:56 ` [PATCH 2/5] drm/amdgpu: Fix the null pointer dereference to ras_manager Ma Jun
2024-05-13 10:21 ` Lazar, Lijo
2024-05-13 8:56 ` [PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle Ma Jun
2024-05-13 10:25 ` Lazar, Lijo
2024-05-13 23:13 ` Wang, Yang(Kevin) [this message]
2024-05-14 1:00 ` Ma, Jun
2024-05-14 4:18 ` Lazar, Lijo
2024-05-13 8:56 ` [PATCH 4/5] drm/amdgpu: Fix null pointer dereference to bo Ma Jun
2024-05-13 12:40 ` Christian König
2024-05-13 8:56 ` [PATCH 5/5] drm/amdgpu: Remove dead code in amdgpu_ras_add_mca_err_addr Ma Jun
2024-05-14 1:52 ` Chai, Thomas
2024-05-14 2:15 ` [PATCH 1/5] drm/amdgpu/pm: Fix the null pointer dereference for smu7 Wang, Yang(Kevin)
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=PH7PR12MB5997912FE549D642FE2AEE5782E22@PH7PR12MB5997.namprd12.prod.outlook.com \
--to=kevinyang.wang@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Jun.Ma2@amd.com \
--cc=Kenneth.Feng@amd.com \
--cc=amd-gfx@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.