Skip to content

Commit

Permalink
drm/amd/display: Avoid overflow from uint32_t to uint8_t
Browse files Browse the repository at this point in the history
[ Upstream commit d6b5490 ]

[WHAT & HOW]
dmub_rb_cmd's ramping_boundary has size of uint8_t and it is assigned
0xFFFF. Fix it by changing it to uint8_t with value of 0xFF.

This fixes 2 INTEGER_OVERFLOW issues reported by Coverity.

Reviewed-by: Rodrigo Siqueira <[email protected]>
Acked-by: Zaeem Mohamed <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Alex Hung authored and gregkh committed Sep 8, 2024
1 parent 31c254c commit 30d1b78
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ bool dmub_abm_set_pipe(struct abm *abm,
{
union dmub_rb_cmd cmd;
struct dc_context *dc = abm->ctx;
uint32_t ramping_boundary = 0xFFFF;
uint8_t ramping_boundary = 0xFF;

memset(&cmd, 0, sizeof(cmd));
cmd.abm_set_pipe.header.type = DMUB_CMD__ABM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst,
{
union dmub_rb_cmd cmd;
struct dc_context *dc = abm->ctx;
uint32_t ramping_boundary = 0xFFFF;
uint8_t ramping_boundary = 0xFF;

memset(&cmd, 0, sizeof(cmd));
cmd.abm_set_pipe.header.type = DMUB_CMD__ABM;
Expand Down

0 comments on commit 30d1b78

Please sign in to comment.