From: Ma Jun Date: Wed, 24 Apr 2024 07:44:56 +0000 (+0800) Subject: drm/amdgpu: Fix the uninitialized variable warning X-Git-Tag: v6.11-rc1~141^2~25^2~315 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7e39d7ec35883a168343ea02f40e260e176c6c63;p=thirdparty%2Fkernel%2Flinux.git drm/amdgpu: Fix the uninitialized variable warning Check the user input and phy_id value range to fix "Using uninitialized value phy_id" Signed-off-by: Ma Jun Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c index 8ed0e073656f8..41ebe690eeffa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c @@ -135,6 +135,10 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __u mutex_unlock(&psp->securedisplay_context.mutex); break; case 2: + if (size < 3 || phy_id >= TA_SECUREDISPLAY_MAX_PHY) { + dev_err(adev->dev, "Invalid input: %s\n", str); + return -EINVAL; + } mutex_lock(&psp->securedisplay_context.mutex); psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd, TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC);