LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message
@ 2023-09-26  5:56 Cong Liu
  2023-09-26 13:09 ` Harry Wentland
  0 siblings, 1 reply; 6+ messages in thread
From: Cong Liu @ 2023-09-26  5:56 UTC (permalink / raw
  To: Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, Pan, Xinhui, David Airlie, Daniel Vetter,
	Aurabindo Pillai, Tom Chung
  Cc: Cong Liu, amd-gfx, dri-devel, linux-kernel

This patch fixes a null pointer dereference in the error message that is
printed when the Display Core (DC) fails to initialize. The original
message includes the DC version number, which is undefined if the DC is
not initialized.

Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC")
Signed-off-by: Cong Liu <liucong2@kylinos.cn>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8e98dda1e084..bf52a909f558 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 		DRM_INFO("Display Core v%s initialized on %s\n", DC_VER,
 			 dce_version_to_string(adev->dm.dc->ctx->dce_version));
 	} else {
-		DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER,
-			 dce_version_to_string(adev->dm.dc->ctx->dce_version));
+		DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER);
 		goto error;
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message
  2023-09-26  5:56 [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message Cong Liu
@ 2023-09-26 13:09 ` Harry Wentland
  2023-09-27  2:15   ` Cong Liu
  2023-09-27  5:23   ` Christian König
  0 siblings, 2 replies; 6+ messages in thread
From: Harry Wentland @ 2023-09-26 13:09 UTC (permalink / raw
  To: Cong Liu, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, Pan, Xinhui, David Airlie, Daniel Vetter,
	Aurabindo Pillai, Tom Chung
  Cc: amd-gfx, dri-devel, linux-kernel



On 2023-09-26 01:56, Cong Liu wrote:
> This patch fixes a null pointer dereference in the error message that is
> printed when the Display Core (DC) fails to initialize. The original
> message includes the DC version number, which is undefined if the DC is
> not initialized.
> 
> Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC")
> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 8e98dda1e084..bf52a909f558 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
>  		DRM_INFO("Display Core v%s initialized on %s\n", DC_VER,
>  			 dce_version_to_string(adev->dm.dc->ctx->dce_version));
>  	} else {
> -		DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER,
> -			 dce_version_to_string(adev->dm.dc->ctx->dce_version));
> +		DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER);

There is value in printing the version number. Let's not remove it.

Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx.

Harry

>  		goto error;
>  	}
>  


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message
  2023-09-26 13:09 ` Harry Wentland
@ 2023-09-27  2:15   ` Cong Liu
  2023-09-27  5:23   ` Christian König
  1 sibling, 0 replies; 6+ messages in thread
From: Cong Liu @ 2023-09-27  2:15 UTC (permalink / raw
  To: Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, Pan, Xinhui, David Airlie, Daniel Vetter,
	Aurabindo Pillai, Tom Chung
  Cc: amd-gfx, dri-devel, linux-kernel


> 
> 
> On 2023-09-26 01:56, Cong Liu wrote:
>> This patch fixes a null pointer dereference in the error message that is
>> printed when the Display Core (DC) fails to initialize. The original
>> message includes the DC version number, which is undefined if the DC is
>> not initialized.
>>
>> Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC")
>> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 8e98dda1e084..bf52a909f558 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
>>   		DRM_INFO("Display Core v%s initialized on %s\n", DC_VER,
>>   			 dce_version_to_string(adev->dm.dc->ctx->dce_version));
>>   	} else {
>> -		DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER,
>> -			 dce_version_to_string(adev->dm.dc->ctx->dce_version));
>> +		DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER);
> 
> There is value in printing the version number. Let's not remove it.
> 
> Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx.

Hi Harry

I don't understand what you mean. Are you saying that I need to add a 
NULL check in the if statement (i.e. if(adev->dm.dc && 
adev->dm.dc->ctx)), because adev->dm.dc is NULL in the else statement 
and there is no way to print adev->dm.dc->ctx->dce_version.

Regards
Cong

> 
> Harry
> 
>>   		goto error;
>>   	}
>>   
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message
  2023-09-26 13:09 ` Harry Wentland
  2023-09-27  2:15   ` Cong Liu
@ 2023-09-27  5:23   ` Christian König
  2023-09-27 14:07     ` Harry Wentland
  1 sibling, 1 reply; 6+ messages in thread
From: Christian König @ 2023-09-27  5:23 UTC (permalink / raw
  To: Harry Wentland, Cong Liu, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Pan, Xinhui, David Airlie, Daniel Vetter, Aurabindo Pillai,
	Tom Chung
  Cc: amd-gfx, dri-devel, linux-kernel

Am 26.09.23 um 15:09 schrieb Harry Wentland:
>
> On 2023-09-26 01:56, Cong Liu wrote:
>> This patch fixes a null pointer dereference in the error message that is
>> printed when the Display Core (DC) fails to initialize. The original
>> message includes the DC version number, which is undefined if the DC is
>> not initialized.
>>
>> Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC")
>> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 8e98dda1e084..bf52a909f558 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
>>   		DRM_INFO("Display Core v%s initialized on %s\n", DC_VER,
>>   			 dce_version_to_string(adev->dm.dc->ctx->dce_version));
>>   	} else {
>> -		DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER,
>> -			 dce_version_to_string(adev->dm.dc->ctx->dce_version));
>> +		DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER);
> There is value in printing the version number. Let's not remove it.
>
> Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx.

But as far as I understand it adev->dm.dc->ctx will always be NULL in 
this case.

Regards,
Christian.

>
> Harry
>
>>   		goto error;
>>   	}
>>   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message
  2023-09-27  5:23   ` Christian König
@ 2023-09-27 14:07     ` Harry Wentland
  2023-09-27 17:44       ` Harry Wentland
  0 siblings, 1 reply; 6+ messages in thread
From: Harry Wentland @ 2023-09-27 14:07 UTC (permalink / raw
  To: Christian König, Cong Liu, Leo Li, Rodrigo Siqueira,
	Alex Deucher, Pan, Xinhui, David Airlie, Daniel Vetter,
	Aurabindo Pillai, Tom Chung
  Cc: amd-gfx, dri-devel, linux-kernel



On 2023-09-27 01:23, Christian König wrote:
> Am 26.09.23 um 15:09 schrieb Harry Wentland:
>>
>> On 2023-09-26 01:56, Cong Liu wrote:
>>> This patch fixes a null pointer dereference in the error message that is
>>> printed when the Display Core (DC) fails to initialize. The original
>>> message includes the DC version number, which is undefined if the DC is
>>> not initialized.
>>>
>>> Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC")
>>> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
>>> ---
>>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>> index 8e98dda1e084..bf52a909f558 100644
>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>> @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
>>>           DRM_INFO("Display Core v%s initialized on %s\n", DC_VER,
>>>                dce_version_to_string(adev->dm.dc->ctx->dce_version));
>>>       } else {
>>> -        DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER,
>>> -             dce_version_to_string(adev->dm.dc->ctx->dce_version));
>>> +        DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER);
>> There is value in printing the version number. Let's not remove it.
>>
>> Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx.
> 
> But as far as I understand it adev->dm.dc->ctx will always be NULL in this case.
> 

Thanks, Christian. We're in the else of the NULL check for
adev-dm.dc, so obviously we can't get the version. Silly me.

Your patch is
Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> Regards,
> Christian.
> 
>>
>> Harry
>>
>>>           goto error;
>>>       }
>>>   
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message
  2023-09-27 14:07     ` Harry Wentland
@ 2023-09-27 17:44       ` Harry Wentland
  0 siblings, 0 replies; 6+ messages in thread
From: Harry Wentland @ 2023-09-27 17:44 UTC (permalink / raw
  To: Christian König, Cong Liu, Leo Li, Rodrigo Siqueira,
	Alex Deucher, Pan, Xinhui, David Airlie, Daniel Vetter,
	Aurabindo Pillai, Tom Chung
  Cc: dri-devel, amd-gfx, linux-kernel



On 2023-09-27 10:07, Harry Wentland wrote:
> 
> 
> On 2023-09-27 01:23, Christian König wrote:
>> Am 26.09.23 um 15:09 schrieb Harry Wentland:
>>>
>>> On 2023-09-26 01:56, Cong Liu wrote:
>>>> This patch fixes a null pointer dereference in the error message that is
>>>> printed when the Display Core (DC) fails to initialize. The original
>>>> message includes the DC version number, which is undefined if the DC is
>>>> not initialized.
>>>>
>>>> Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC")
>>>> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
>>>> ---
>>>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
>>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>> index 8e98dda1e084..bf52a909f558 100644
>>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>> @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
>>>>           DRM_INFO("Display Core v%s initialized on %s\n", DC_VER,
>>>>                dce_version_to_string(adev->dm.dc->ctx->dce_version));
>>>>       } else {
>>>> -        DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER,
>>>> -             dce_version_to_string(adev->dm.dc->ctx->dce_version));
>>>> +        DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER);
>>> There is value in printing the version number. Let's not remove it.
>>>
>>> Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx.
>>
>> But as far as I understand it adev->dm.dc->ctx will always be NULL in this case.
>>
> 
> Thanks, Christian. We're in the else of the NULL check for
> adev-dm.dc, so obviously we can't get the version. Silly me.
> 
> Your patch is
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
> 

Patch is merged.

Harry

> Harry
> 
>> Regards,
>> Christian.
>>
>>>
>>> Harry
>>>
>>>>           goto error;
>>>>       }
>>>>   
>>
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-27 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-26  5:56 [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message Cong Liu
2023-09-26 13:09 ` Harry Wentland
2023-09-27  2:15   ` Cong Liu
2023-09-27  5:23   ` Christian König
2023-09-27 14:07     ` Harry Wentland
2023-09-27 17:44       ` Harry Wentland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).