Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
drm/amd/display: Initialize denominators' default to 1
Browse files Browse the repository at this point in the history
[ Upstream commit b995c0a ]

[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]>
  • Loading branch information
Alex Hung authored and gregkh committed Dec 3, 2024
1 parent 6d58533 commit d95adf8
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 d95adf8

Please sign in to comment.