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

Commit d8ee900

Browse files
srishanmgregkh
authored andcommitted
drm/amd/display: Add NULL check for function pointer in dcn401_set_output_transfer_func
[ Upstream commit dd340ac ] This commit adds a null check for the set_output_gamma function pointer in the dcn401_set_output_transfer_func function. Previously, set_output_gamma was being checked for null, but then it was being dereferenced without any null check. This could lead to a null pointer dereference 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. 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 827380b commit d8ee900

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,9 @@ bool dcn401_set_output_transfer_func(struct dc *dc,
748748
}
749749
}
750750

751-
mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
751+
if (mpc->funcs->set_output_gamma)
752+
mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
753+
752754
return ret;
753755
}
754756

0 commit comments

Comments
 (0)