]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
drm/amd/display: Fix potential NULL pointer dereferences in 'dcn10_set_output_transfe...
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Thu, 25 Jan 2024 15:46:04 +0000 (21:16 +0530)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:20:45 +0000 (18:20 -0400)
[ Upstream commit 9ccfe80d022df7c595f1925afb31de2232900656 ]

The 'stream' pointer is used in dcn10_set_output_transfer_func() before
the check if 'stream' is NULL.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn10/dcn10_hwseq.c:1892 dcn10_set_output_transfer_func() warn: variable dereferenced before check 'stream' (see line 1875)

Fixes: ddef02de0d71 ("drm/amd/display: add null checks before logging")
Cc: Wyatt Wood <wyatt.wood@amd.com>
Cc: Anthony Koo <Anthony.Koo@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c

index 009b5861a3fecd57b4a157eced924d6c23556cc1..d6c5d48c878eca8b97f5d0995ed67c117b901975 100644 (file)
@@ -1854,6 +1854,9 @@ bool dcn10_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx,
 {
        struct dpp *dpp = pipe_ctx->plane_res.dpp;
 
+       if (!stream)
+               return false;
+
        if (dpp == NULL)
                return false;
 
@@ -1876,8 +1879,8 @@ bool dcn10_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx,
        } else
                dpp->funcs->dpp_program_regamma_pwl(dpp, NULL, OPP_REGAMMA_BYPASS);
 
-       if (stream != NULL && stream->ctx != NULL &&
-                       stream->out_transfer_func != NULL) {
+       if (stream->ctx &&
+           stream->out_transfer_func) {
                log_tf(stream->ctx,
                                stream->out_transfer_func,
                                dpp->regamma_params.hw_points_num);