Skip to content

Commit 30d1b78

Browse files
Alex Hunggregkh
authored andcommitted
drm/amd/display: Avoid overflow from uint32_t to uint8_t
[ 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 <rodrigo.siqueira@amd.com> Acked-by: Zaeem Mohamed <zaeem.mohamed@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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 31c254c commit 30d1b78

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ bool dmub_abm_set_pipe(struct abm *abm,
258258
{
259259
union dmub_rb_cmd cmd;
260260
struct dc_context *dc = abm->ctx;
261-
uint32_t ramping_boundary = 0xFFFF;
261+
uint8_t ramping_boundary = 0xFF;
262262

263263
memset(&cmd, 0, sizeof(cmd));
264264
cmd.abm_set_pipe.header.type = DMUB_CMD__ABM;

drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst,
142142
{
143143
union dmub_rb_cmd cmd;
144144
struct dc_context *dc = abm->ctx;
145-
uint32_t ramping_boundary = 0xFFFF;
145+
uint8_t ramping_boundary = 0xFF;
146146

147147
memset(&cmd, 0, sizeof(cmd));
148148
cmd.abm_set_pipe.header.type = DMUB_CMD__ABM;

0 commit comments

Comments
 (0)