Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 827380b

Browse files
srishanmgregkh
authored andcommitted
drm/amd/display: Add NULL check for function pointer in dcn20_set_output_transfer_func
[ Upstream commit 62ed6f0 ] This commit adds a null check for the set_output_gamma function pointer in the dcn20_set_output_transfer_func function. Previously, set_output_gamma was being checked for null at line 1030, but then it was being dereferenced without any null check at line 1048. This could potentially lead to a null pointer dereference error if set_output_gamma is null. To fix this, we now ensure that set_output_gamma is not null before dereferencing it. We do this by adding a null check for set_output_gamma before the call to set_output_gamma at line 1048. Cc: Tom Chung <chiahsuan.chung@amd.com> Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Cc: Roman Li <roman.li@amd.com> Cc: Alex Hung <alex.hung@amd.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Hamza Mahfooz <hamza.mahfooz@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0ffd9fb commit 827380b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,8 @@ bool dcn20_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx,
10441044
/*
10451045
* if above if is not executed then 'params' equal to 0 and set in bypass
10461046
*/
1047-
mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
1047+
if (mpc->funcs->set_output_gamma)
1048+
mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
10481049

10491050
return true;
10501051
}

0 commit comments

Comments
 (0)