[PATCH v3] drm/amdgpu: Fix the uninitialized variable warning

Ma, Jun majun at amd.com
Mon Apr 29 08:04:49 UTC 2024


ping ...

On 4/26/2024 5:37 PM, Ma Jun wrote:
> Check the user input and phy_id value range to fix
> "Using uninitialized value phy_id"
> 
> Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> index 8ed0e073656f..41ebe690eeff 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);


More information about the amd-gfx mailing list