Skip to content

Commit

Permalink
drm/amd/display: Initialize denominators' default to 1
Browse files Browse the repository at this point in the history
[ 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 <[email protected]>
Signed-off-by: Jerry Zuo <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
[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 <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 9f35cec5e4b9759b38c663d18eae4eaf30f36527)
  • Loading branch information
Alex Hung authored and opsiff committed Dec 9, 2024
1 parent be5799e commit 4767131
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
unsigned int ret_val = 0;
unsigned int ret_val = 1;

if (source_format == dm_444_16) {
if (!is_chroma)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

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 (!is_chroma)
Expand Down

0 comments on commit 4767131

Please sign in to comment.