drm/amd/display: Initialize denominators' default to 1

[ Upstream commit b995c0a6de6c74656a0c39cd57a0626351b13e3c ]

[WHAT & HOW]
Variables used as denominators and maybe not assigned to other values,
should not be 0. Change their default to 1 so they are never 0.

This fixes 10 DIVIDE_BY_ZERO issues reported by Coverity.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Jerry Zuo <jerry.zuo@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[Xiangyu: Bp to fix CVE: CVE-2024-49899
Discard the dml2_core/dml2_core_shared.c due to this file no exists]
Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Alex Hung
2024-11-26 17:36:04 +08:00
committed by Greg Kroah-Hartman
parent b04650b5a9
commit 9be768f08b
2 changed files with 2 additions and 2 deletions

View File

@@ -78,7 +78,7 @@ static void calculate_ttu_cursor(struct display_mode_lib *mode_lib,
static unsigned int get_bytes_per_element(enum source_format_class source_format, bool is_chroma) static unsigned int get_bytes_per_element(enum source_format_class source_format, bool is_chroma)
{ {
unsigned int ret_val = 0; unsigned int ret_val = 1;
if (source_format == dm_444_16) { if (source_format == dm_444_16) {
if (!is_chroma) if (!is_chroma)

View File

@@ -39,7 +39,7 @@
static unsigned int get_bytes_per_element(enum source_format_class source_format, bool is_chroma) static unsigned int get_bytes_per_element(enum source_format_class source_format, bool is_chroma)
{ {
unsigned int ret_val = 0; unsigned int ret_val = 1;
if (source_format == dm_444_16) { if (source_format == dm_444_16) {
if (!is_chroma) if (!is_chroma)