Skip to content

Commit 69133b8

Browse files
AMD-aricalexdeucher
authored andcommitted
drm/amd/display: Fix up coverity issues
[Why] Coverity found various high-impact issues that need resolving. [How] Fix some buffer overruns and uninitialized variables. Signed-off-by: Aric Cyr <aric.cyr@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Leo Li <sunpeng.li@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent ddc07a3 commit 69133b8

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎drivers/gpu/drm/amd/display/dc/bios/bios_parser.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,7 @@ static uint32_t get_src_obj_list(struct bios_parser *bp, ATOM_OBJECT *object,
20302030
static struct device_id device_type_from_device_id(uint16_t device_id)
20312031
{
20322032

2033-
struct device_id result_device_id;
2033+
struct device_id result_device_id = {0};
20342034

20352035
switch (device_id) {
20362036
case ATOM_DEVICE_LCD1_SUPPORT:

‎drivers/gpu/drm/amd/display/dc/core/dc_debug.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ void context_timing_trace(
311311
{
312312
int i;
313313
struct dc *core_dc = dc;
314-
int h_pos[MAX_PIPES], v_pos[MAX_PIPES];
314+
int h_pos[MAX_PIPES] = {0}, v_pos[MAX_PIPES] = {0};
315315
struct crtc_position position;
316316
unsigned int underlay_idx = core_dc->res_pool->underlay_pipe_index;
317317
DC_LOGGER_INIT(dc->ctx->logger);
@@ -322,8 +322,7 @@ void context_timing_trace(
322322
/* get_position() returns CRTC vertical/horizontal counter
323323
* hence not applicable for underlay pipe
324324
*/
325-
if (pipe_ctx->stream == NULL
326-
|| pipe_ctx->pipe_idx == underlay_idx)
325+
if (pipe_ctx->stream == NULL || pipe_ctx->pipe_idx == underlay_idx)
327326
continue;
328327

329328
pipe_ctx->stream_res.tg->funcs->get_position(pipe_ctx->stream_res.tg, &position);
@@ -333,7 +332,7 @@ void context_timing_trace(
333332
for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
334333
struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
335334

336-
if (pipe_ctx->stream == NULL)
335+
if (pipe_ctx->stream == NULL || pipe_ctx->pipe_idx == underlay_idx)
337336
continue;
338337

339338
TIMING_TRACE("OTG_%d H_tot:%d V_tot:%d H_pos:%d V_pos:%d\n",

‎drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,14 +548,14 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
548548

549549
regamma_params->hw_points_num = hw_points;
550550

551-
i = 1;
552-
for (k = 0; k < 16 && i < 16; k++) {
551+
k = 0;
552+
for (i = 1; i < 16; i++) {
553553
if (seg_distr[k] != -1) {
554554
regamma_params->arr_curve_points[k].segments_num = seg_distr[k];
555555
regamma_params->arr_curve_points[i].offset =
556556
regamma_params->arr_curve_points[k].offset + (1 << seg_distr[k]);
557557
}
558-
i++;
558+
k++;
559559
}
560560

561561
if (seg_distr[k] != -1)

0 commit comments

Comments
 (0)