mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] drm/amd/display: fix NULL dereference
@ 2023-11-14 15:27 José Pekkarinen
  2023-11-14 21:01 ` Hamza Mahfooz
  0 siblings, 1 reply; 3+ messages in thread
From: José Pekkarinen @ 2023-11-14 15:27 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, skhan
  Cc: José Pekkarinen, airlied, daniel, Wayne.Lin, qingqing.zhuo,
	lyude, srinivasan.shanmugam, aurabindo.pillai, sungjoon.kim,
	wenjing.liu, hamza.mahfooz, mikita.lipski, amd-gfx, dri-devel,
	linux-kernel, linux-kernel-mentees

The following patch will fix a minor issue where a debug message is
referencing an struct that has just being checked whether is null or
not. This has been noticed by using coccinelle, in the following output:

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c:540:25-29: ERROR: aconnector is NULL but dereferenced.

Fixes: 5d72e247e58c9 ("drm/amd/display: switch DC over to the new DRM logging macros")
Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
---
[v1 -> v2]: Remove the debugging message, requested by Hamza

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index ed784cf27d39..c7a29bb737e2 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -536,11 +536,8 @@ bool dm_helpers_dp_read_dpcd(
 
 	struct amdgpu_dm_connector *aconnector = link->priv;
 
-	if (!aconnector) {
-		drm_dbg_dp(aconnector->base.dev,
-			   "Failed to find connector for link!\n");
+	if (!aconnector)
 		return false;
-	}
 
 	return drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address, data,
 				size) == size;
-- 
2.39.2


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

* Re: [PATCH v2] drm/amd/display: fix NULL dereference
  2023-11-14 15:27 [PATCH v2] drm/amd/display: fix NULL dereference José Pekkarinen
@ 2023-11-14 21:01 ` Hamza Mahfooz
  2023-11-15  5:52   ` José Pekkarinen
  0 siblings, 1 reply; 3+ messages in thread
From: Hamza Mahfooz @ 2023-11-14 21:01 UTC (permalink / raw)
  To: José Pekkarinen, harry.wentland, sunpeng.li,
	Rodrigo.Siqueira, alexander.deucher, christian.koenig,
	Xinhui.Pan, skhan
  Cc: airlied, daniel, Wayne.Lin, qingqing.zhuo, lyude,
	srinivasan.shanmugam, aurabindo.pillai, sungjoon.kim,
	wenjing.liu, mikita.lipski, amd-gfx, dri-devel, linux-kernel,
	linux-kernel-mentees

On 11/14/23 10:27, José Pekkarinen wrote:
> The following patch will fix a minor issue where a debug message is
> referencing an struct that has just being checked whether is null or
> not. This has been noticed by using coccinelle, in the following output:
> 
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c:540:25-29: ERROR: aconnector is NULL but dereferenced.
> 
> Fixes: 5d72e247e58c9 ("drm/amd/display: switch DC over to the new DRM logging macros")

You only need the first 12 characters of the hash here. I have fixed it
for you and applied the patch in this case. But, in the future please
test your patches against `./scripts/checkpatch.pl` before submitting
them.

> Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
> ---
> [v1 -> v2]: Remove the debugging message, requested by Hamza
> 
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> index ed784cf27d39..c7a29bb737e2 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> @@ -536,11 +536,8 @@ bool dm_helpers_dp_read_dpcd(
>   
>   	struct amdgpu_dm_connector *aconnector = link->priv;
>   
> -	if (!aconnector) {
> -		drm_dbg_dp(aconnector->base.dev,
> -			   "Failed to find connector for link!\n");
> +	if (!aconnector)
>   		return false;
> -	}
>   
>   	return drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address, data,
>   				size) == size;
-- 
Hamza


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

* Re: [PATCH v2] drm/amd/display: fix NULL dereference
  2023-11-14 21:01 ` Hamza Mahfooz
@ 2023-11-15  5:52   ` José Pekkarinen
  0 siblings, 0 replies; 3+ messages in thread
From: José Pekkarinen @ 2023-11-15  5:52 UTC (permalink / raw)
  To: Hamza Mahfooz
  Cc: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, skhan, airlied, daniel, Wayne.Lin,
	qingqing.zhuo, lyude, srinivasan.shanmugam, aurabindo.pillai,
	sungjoon.kim, wenjing.liu, mikita.lipski, amd-gfx, dri-devel,
	linux-kernel, linux-kernel-mentees

On 2023-11-14 23:01, Hamza Mahfooz wrote:
> On 11/14/23 10:27, José Pekkarinen wrote:
>> The following patch will fix a minor issue where a debug message is
>> referencing an struct that has just being checked whether is null or
>> not. This has been noticed by using coccinelle, in the following 
>> output:
>> 
>> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c:540:25-29: 
>> ERROR: aconnector is NULL but dereferenced.
>> 
>> Fixes: 5d72e247e58c9 ("drm/amd/display: switch DC over to the new DRM 
>> logging macros")
> 
> You only need the first 12 characters of the hash here. I have fixed it
> for you and applied the patch in this case. But, in the future please
> test your patches against `./scripts/checkpatch.pl` before submitting
> them.

     Oops! Sorry I didn't notice! Thanks!

     José.

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

end of thread, other threads:[~2023-11-15  6:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-14 15:27 [PATCH v2] drm/amd/display: fix NULL dereference José Pekkarinen
2023-11-14 21:01 ` Hamza Mahfooz
2023-11-15  5:52   ` José Pekkarinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®