[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240211150613.3583-1-d.dulov@aladdin.ru>
Date: Sun, 11 Feb 2024 07:06:13 -0800
From: Daniil Dulov <d.dulov@...ddin.ru>
To: David Airlie <airlied@...ux.ie>
CC: Daniil Dulov <d.dulov@...ddin.ru>, Christian König
<christian.koenig@....com>, Alex Deucher <alexander.deucher@....com>, Daniel
Vetter <daniel@...ll.ch>, Evan Quan <evan.quan@....com>,
<amd-gfx@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH] drm/amdgpu/swsmu: Fix if statement in smu_baco_get_state()
In smu_baco_get_state() smu->ppt_funcs->baco_get_state is checked for NULL.
If it is NULL then the pointer is dereferenced.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 6c45e480fe23 ("drm/amd/powerplay: clear the swSMU code layer")
Signed-off-by: Daniil Dulov <d.dulov@...ddin.ru>
---
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index ee27970cfff9..0fadb6aacd4b 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -2497,7 +2497,7 @@ bool smu_baco_is_support(struct smu_context *smu)
int smu_baco_get_state(struct smu_context *smu, enum smu_baco_state *state)
{
- if (smu->ppt_funcs->baco_get_state)
+ if (!smu->ppt_funcs->baco_get_state)
return -EINVAL;
mutex_lock(&smu->mutex);
--
2.25.1
Powered by blists - more mailing lists