Commit 574ff46f authored by Tom Rix's avatar Tom Rix Committed by Alex Deucher
Browse files

drm/amdkfd: fix freeing an unset pointer



clang static analysis reports this problem
kfd_chardev.c:2092:2: warning: 1st function call argument
  is an uninitialized value
        kvfree(bo_privs);
        ^~~~~~~~~~~~~~~~

When bo_buckets alloc fails, it jumps to an error handler
that frees the yet to be allocated bo_privs.  Because
bo_buckets is the first error, return directly.

Fixes: 5ccbb057 ("drm/amdkfd: CRIU Implement KFD checkpoint ioctl")
Signed-off-by: default avatarTom Rix <trix@redhat.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5aa71bd7
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -1708,10 +1708,8 @@ static int criu_checkpoint_bos(struct kfd_process *p,
	void *mem;

	bo_buckets = kvzalloc(num_bos * sizeof(*bo_buckets), GFP_KERNEL);
	if (!bo_buckets) {
		ret = -ENOMEM;
		goto exit;
	}
	if (!bo_buckets)
		return -ENOMEM;

	bo_privs = kvzalloc(num_bos * sizeof(*bo_privs), GFP_KERNEL);
	if (!bo_privs) {