diff options
| author | Alex Hung <[email protected]> | 2024-06-06 21:42:36 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2024-06-27 21:10:37 +0000 |
| commit | e1f4805bcc6b39e1c249777c237e419705266234 (patch) | |
| tree | a82c30948860e18dfc328abb123693a954814946 /drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c | |
| parent | drm/amd/display: Fix reduced resolution and refresh rate (diff) | |
| download | kernel-e1f4805bcc6b39e1c249777c237e419705266234.tar.gz kernel-e1f4805bcc6b39e1c249777c237e419705266234.zip | |
drm/amd/display: Add null checks before accessing struct elements
[WHAT]
1. is_pwrseq0 needs to check link before accessing link->link_index.
2. context is checked before accessing its bw_ctx.dml2
3. clk_mgr_base->bw_params is checked before clk_table.num_entries_per_cl
This fixes 4 REVERSE_INULL issues reported by Coverity.
Reviewed-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c')
| -rw-r--r-- | drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c index f4038ac2e476..90bb6e718301 100644 --- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c @@ -687,12 +687,14 @@ static bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_s static bool dml2_validate_only(struct dc_state *context) { - struct dml2_context *dml2 = context->bw_ctx.dml2; + struct dml2_context *dml2; unsigned int result = 0; if (!context || context->stream_count == 0) return true; + dml2 = context->bw_ctx.dml2; + /* Zero out before each call before proceeding */ memset(&dml2->v20.scratch, 0, sizeof(struct dml2_wrapper_scratch)); memset(&dml2->v20.dml_core_ctx.policy, 0, sizeof(struct dml_mode_eval_policy_st)); |
