Re: [PATCH] drm/amd/display: Fix NULL pointer dereference in dmub_tracebuffer_show

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 12, 2024 at 03:07:58PM +0530, Srinivasan Shanmugam wrote:
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> index 11a7ac54f91c..0092d4a1e59d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> @@ -902,7 +902,7 @@ static int dmub_tracebuffer_show(struct seq_file *m, void *data)
>  {
>  	struct amdgpu_device *adev = m->private;
>  	struct dmub_srv_fb_info *fb_info = adev->dm.dmub_fb_info;
> -	struct dmub_fw_meta_info *fw_meta_info = &adev->dm.dmub_srv->meta_info;
> +	struct dmub_fw_meta_info *fw_meta_info;

This needs to be initialized to NULL.

	struct dmub_fw_meta_info *fw_meta_info = NULL;

otherwise it's uninitialized later.

>  	struct dmub_debugfs_trace_entry *entries;
>  	uint8_t *tbuf_base;
>  	uint32_t tbuf_size, max_entries, num_entries, first_entry, i;
> @@ -914,6 +914,9 @@ static int dmub_tracebuffer_show(struct seq_file *m, void *data)
>  	if (!tbuf_base)
>  		return 0;
>  
> +	if (adev->dm.dmub_srv)
> +		fw_meta_info = &adev->dm.dmub_srv->meta_info;
> +
>  	tbuf_size = fw_meta_info ? fw_meta_info->trace_buffer_size :
>  				   DMUB_TRACE_BUFFER_SIZE;
>  	max_entries = (tbuf_size - sizeof(struct dmub_debugfs_trace_header)) /

regards,
dan carpenter



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux