Skip to content

Commit

Permalink
drm/amd/display: Add NULL check for function pointer in dcn32_set_out…
Browse files Browse the repository at this point in the history
…put_transfer_func

[ Upstream commit 28574b08c70e56d34d6f6379326a860b96749051 ]

This commit adds a null check for the set_output_gamma function pointer
in the dcn32_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 <[email protected]>
Cc: Rodrigo Siqueira <[email protected]>
Cc: Roman Li <[email protected]>
Cc: Alex Hung <[email protected]>
Cc: Aurabindo Pillai <[email protected]>
Cc: Harry Wentland <[email protected]>
Cc: Hamza Mahfooz <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Tom Chung <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Xiangyu Chen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit f38b09ba6a335c511eb27920bb9bb4a1b2c20084)
  • Loading branch information
srishanm authored and opsiff committed Dec 9, 2024
1 parent 492d57b commit be5799e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,9 @@ bool dcn32_set_output_transfer_func(struct dc *dc,
}
}

mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
if (mpc->funcs->set_output_gamma)
mpc->funcs->set_output_gamma(mpc, mpcc_id, params);

return ret;
}

Expand Down

0 comments on commit be5799e

Please sign in to comment.