drm/amd/display: Fix potential NULL pointer dereferences in 'dcn10_set_output_transfe...
authorjsg <jsg@openbsd.org>
Wed, 27 Mar 2024 04:40:04 +0000 (04:40 +0000)
committerjsg <jsg@openbsd.org>
Wed, 27 Mar 2024 04:40:04 +0000 (04:40 +0000)
From Srinivasan Shanmugam
2d9fe7787af01188dc470a649bdbb842d6511fd7 in linux-6.6.y/6.6.23
9ccfe80d022df7c595f1925afb31de2232900656 in mainline linux

sys/dev/pci/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c

index db1d7be..e3f4d49 100644 (file)
@@ -1832,6 +1832,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;
 
@@ -1854,8 +1857,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);