* [PATCH 1/1] drm/amdkfd: Fix criu_restore_bo error handling
@ 2022-02-18 22:32 Felix Kuehling
2022-02-18 22:45 ` Bhardwaj, Rajneesh
0 siblings, 1 reply; 2+ messages in thread
From: Felix Kuehling @ 2022-02-18 22:32 UTC (permalink / raw)
To: amd-gfx; +Cc: Tom Rix, rajneesh.bhardwaj
Clang static analysis reports this problem
kfd_chardev.c:2327:2: warning: 1st function call argument
is an uninitialized value
kvfree(bo_privs);
^~~~~~~~~~~~~~~~
Make sure bo_buckets and bo_privs are initialized so freeing them in the
error handling code path will never result in undefined behaviour.
Fixes: 73fa13b6a511 ("drm/amdkfd: CRIU Implement KFD restore ioctl")
Reported-by: Tom Rix <trix@redhat.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index fead2ed46dc6..ceeb0d5e9060 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -2092,8 +2092,8 @@ static int criu_restore_bos(struct kfd_process *p,
uint64_t *priv_offset,
uint64_t max_priv_data_size)
{
- struct kfd_criu_bo_bucket *bo_buckets;
- struct kfd_criu_bo_priv_data *bo_privs;
+ struct kfd_criu_bo_bucket *bo_buckets = NULL;
+ struct kfd_criu_bo_priv_data *bo_privs = NULL;
const bool criu_resume = true;
bool flush_tlbs = false;
int ret = 0, j = 0;
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] drm/amdkfd: Fix criu_restore_bo error handling
2022-02-18 22:32 [PATCH 1/1] drm/amdkfd: Fix criu_restore_bo error handling Felix Kuehling
@ 2022-02-18 22:45 ` Bhardwaj, Rajneesh
0 siblings, 0 replies; 2+ messages in thread
From: Bhardwaj, Rajneesh @ 2022-02-18 22:45 UTC (permalink / raw)
To: Kuehling, Felix, amd-gfx; +Cc: Tom Rix
[-- Attachment #1: Type: text/plain, Size: 1799 bytes --]
[AMD Official Use Only]
Reviewed-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Regards,
Rajneesh
________________________________
From: Kuehling, Felix <Felix.Kuehling@amd.com>
Sent: Friday, February 18, 2022 5:32:18 PM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Bhardwaj, Rajneesh <Rajneesh.Bhardwaj@amd.com>; Tom Rix <trix@redhat.com>
Subject: [PATCH 1/1] drm/amdkfd: Fix criu_restore_bo error handling
Clang static analysis reports this problem
kfd_chardev.c:2327:2: warning: 1st function call argument
is an uninitialized value
kvfree(bo_privs);
^~~~~~~~~~~~~~~~
Make sure bo_buckets and bo_privs are initialized so freeing them in the
error handling code path will never result in undefined behaviour.
Fixes: 73fa13b6a511 ("drm/amdkfd: CRIU Implement KFD restore ioctl")
Reported-by: Tom Rix <trix@redhat.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index fead2ed46dc6..ceeb0d5e9060 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -2092,8 +2092,8 @@ static int criu_restore_bos(struct kfd_process *p,
uint64_t *priv_offset,
uint64_t max_priv_data_size)
{
- struct kfd_criu_bo_bucket *bo_buckets;
- struct kfd_criu_bo_priv_data *bo_privs;
+ struct kfd_criu_bo_bucket *bo_buckets = NULL;
+ struct kfd_criu_bo_priv_data *bo_privs = NULL;
const bool criu_resume = true;
bool flush_tlbs = false;
int ret = 0, j = 0;
--
2.32.0
[-- Attachment #2: Type: text/html, Size: 3488 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-18 22:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 22:32 [PATCH 1/1] drm/amdkfd: Fix criu_restore_bo error handling Felix Kuehling
2022-02-18 22:45 ` Bhardwaj, Rajneesh
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.