Commit 34fb46be authored by Alex Hung's avatar Alex Hung Committed by Tirui Yin
Browse files

drm/amd/display: Pass non-null to dcn20_validate_apply_pipe_split_flags

mainline inclusion
from mainline-v6.12-rc1
commit 5559598742fb4538e4c51c48ef70563c49c2af23
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAYRD1
CVE: CVE-2024-49923

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5559598742fb4538e4c51c48ef70563c49c2af23



--------------------------------

[WHAT & HOW]
"dcn20_validate_apply_pipe_split_flags" dereferences merge, and thus it
cannot be a null pointer. Let's pass a valid pointer to avoid null
dereference.

This fixes 2 FORWARD_NULL issues reported by Coverity.

Reviewed-by: default avatarRodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: default avatarJerry Zuo <jerry.zuo@amd.com>
Signed-off-by: default avatarAlex Hung <alex.hung@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Conflicts:
	drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
	drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c
	drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
	drivers/gpu/drm/amd/display/dc/resource/dcn21/dcn21_resource.c
[Path changed and there is no logical conflict.]
Signed-off-by: default avatarTirui Yin <yintirui@huawei.com>
Reviewed-by: default avatarChen Jun <chenjun102@huawei.com>
parent 40d8143f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2026,6 +2026,7 @@ bool dcn20_fast_validate_bw(
{
	bool out = false;
	int split[MAX_PIPES] = { 0 };
	bool merge[MAX_PIPES] = { false };
	int pipe_cnt, i, pipe_idx, vlevel;

	ASSERT(pipes);
@@ -2050,7 +2051,7 @@ bool dcn20_fast_validate_bw(
	if (vlevel > context->bw_ctx.dml.soc.num_states)
		goto validate_fail;

	vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, NULL);
	vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, merge);

	/*initialize pipe_just_split_from to invalid idx*/
	for (i = 0; i < MAX_PIPES; i++)
+2 −1
Original line number Diff line number Diff line
@@ -800,6 +800,7 @@ bool dcn21_fast_validate_bw(struct dc *dc,
{
	bool out = false;
	int split[MAX_PIPES] = { 0 };
	bool merge[MAX_PIPES] = { false };
	int pipe_cnt, i, pipe_idx, vlevel;

	ASSERT(pipes);
@@ -842,7 +843,7 @@ bool dcn21_fast_validate_bw(struct dc *dc,
			goto validate_fail;
	}

	vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, NULL);
	vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, merge);

	for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
		struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];