Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <Jun.Ma2@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Ma Jun and committed by
Alex Deucher
7e39d7ec df4409d8

+4
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
··· 135 135 mutex_unlock(&psp->securedisplay_context.mutex); 136 136 break; 137 137 case 2: 138 + if (size < 3 || phy_id >= TA_SECUREDISPLAY_MAX_PHY) { 139 + dev_err(adev->dev, "Invalid input: %s\n", str); 140 + return -EINVAL; 141 + } 138 142 mutex_lock(&psp->securedisplay_context.mutex); 139 143 psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd, 140 144 TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC);