Commit 69133b89 authored by Aric Cyr's avatar Aric Cyr Committed by Alex Deucher

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: default avatarAric Cyr <aric.cyr@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ddc07a38
...@@ -2030,7 +2030,7 @@ static uint32_t get_src_obj_list(struct bios_parser *bp, ATOM_OBJECT *object, ...@@ -2030,7 +2030,7 @@ static uint32_t get_src_obj_list(struct bios_parser *bp, ATOM_OBJECT *object,
static struct device_id device_type_from_device_id(uint16_t device_id) static struct device_id device_type_from_device_id(uint16_t device_id)
{ {
struct device_id result_device_id; struct device_id result_device_id = {0};
switch (device_id) { switch (device_id) {
case ATOM_DEVICE_LCD1_SUPPORT: case ATOM_DEVICE_LCD1_SUPPORT:
......
...@@ -311,7 +311,7 @@ void context_timing_trace( ...@@ -311,7 +311,7 @@ void context_timing_trace(
{ {
int i; int i;
struct dc *core_dc = dc; struct dc *core_dc = dc;
int h_pos[MAX_PIPES], v_pos[MAX_PIPES]; int h_pos[MAX_PIPES] = {0}, v_pos[MAX_PIPES] = {0};
struct crtc_position position; struct crtc_position position;
unsigned int underlay_idx = core_dc->res_pool->underlay_pipe_index; unsigned int underlay_idx = core_dc->res_pool->underlay_pipe_index;
DC_LOGGER_INIT(dc->ctx->logger); DC_LOGGER_INIT(dc->ctx->logger);
...@@ -322,8 +322,7 @@ void context_timing_trace( ...@@ -322,8 +322,7 @@ void context_timing_trace(
/* get_position() returns CRTC vertical/horizontal counter /* get_position() returns CRTC vertical/horizontal counter
* hence not applicable for underlay pipe * hence not applicable for underlay pipe
*/ */
if (pipe_ctx->stream == NULL if (pipe_ctx->stream == NULL || pipe_ctx->pipe_idx == underlay_idx)
|| pipe_ctx->pipe_idx == underlay_idx)
continue; continue;
pipe_ctx->stream_res.tg->funcs->get_position(pipe_ctx->stream_res.tg, &position); pipe_ctx->stream_res.tg->funcs->get_position(pipe_ctx->stream_res.tg, &position);
...@@ -333,7 +332,7 @@ void context_timing_trace( ...@@ -333,7 +332,7 @@ void context_timing_trace(
for (i = 0; i < core_dc->res_pool->pipe_count; i++) { for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
if (pipe_ctx->stream == NULL) if (pipe_ctx->stream == NULL || pipe_ctx->pipe_idx == underlay_idx)
continue; continue;
TIMING_TRACE("OTG_%d H_tot:%d V_tot:%d H_pos:%d V_pos:%d\n", TIMING_TRACE("OTG_%d H_tot:%d V_tot:%d H_pos:%d V_pos:%d\n",
......
...@@ -548,14 +548,14 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf, ...@@ -548,14 +548,14 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
regamma_params->hw_points_num = hw_points; regamma_params->hw_points_num = hw_points;
i = 1; k = 0;
for (k = 0; k < 16 && i < 16; k++) { for (i = 1; i < 16; i++) {
if (seg_distr[k] != -1) { if (seg_distr[k] != -1) {
regamma_params->arr_curve_points[k].segments_num = seg_distr[k]; regamma_params->arr_curve_points[k].segments_num = seg_distr[k];
regamma_params->arr_curve_points[i].offset = regamma_params->arr_curve_points[i].offset =
regamma_params->arr_curve_points[k].offset + (1 << seg_distr[k]); regamma_params->arr_curve_points[k].offset + (1 << seg_distr[k]);
} }
i++; k++;
} }
if (seg_distr[k] != -1) if (seg_distr[k] != -1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment