aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2824-drm-amd-display-Bunch-of-smatch-error-and-warning-fi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2824-drm-amd-display-Bunch-of-smatch-error-and-warning-fi.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2824-drm-amd-display-Bunch-of-smatch-error-and-warning-fi.patch116
1 files changed, 116 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2824-drm-amd-display-Bunch-of-smatch-error-and-warning-fi.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2824-drm-amd-display-Bunch-of-smatch-error-and-warning-fi.patch
new file mode 100644
index 00000000..642120eb
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2824-drm-amd-display-Bunch-of-smatch-error-and-warning-fi.patch
@@ -0,0 +1,116 @@
+From 594a367a787934bfc03222d519dbc6979e8f827e Mon Sep 17 00:00:00 2001
+From: Harry Wentland <harry.wentland@amd.com>
+Date: Fri, 10 Nov 2017 11:56:15 -0500
+Subject: [PATCH 2824/4131] drm/amd/display: Bunch of smatch error and warning
+ fixes in DC
+
+drivers/gpu/drm/amd/amdgpu/../display/dc/basics/log_helpers.c:79
+dc_conn_log() error: buffer overflow 'signal_type_info_tbl' 10 <= 10
+drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser.c:266
+bios_parser_get_dst_obj() error: uninitialized symbol 'id'.
+drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_audio.c:357
+dce_aud_az_enable() warn: inconsistent indenting
+drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_resource.c:958
+dcn10_acquire_idle_pipe_for_layer() error: we previously assumed
+'head_pipe' could be null (see line 952)
+
+Signed-off-by: Harry Wentland <harry.wentland@amd.com>
+Reviewed-by: Sun peng Li <Sunpeng.Li@amd.com>
+Acked-by: Harry Wentland <harry.wentland@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/display/dc/basics/log_helpers.c | 5 +++++
+ drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 4 ++--
+ drivers/gpu/drm/amd/display/dc/dce/dce_audio.c | 10 +++++-----
+ drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 6 ++++--
+ 4 files changed, 16 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/basics/log_helpers.c b/drivers/gpu/drm/amd/display/dc/basics/log_helpers.c
+index 785b943..6e43168 100644
+--- a/drivers/gpu/drm/amd/display/dc/basics/log_helpers.c
++++ b/drivers/gpu/drm/amd/display/dc/basics/log_helpers.c
+@@ -75,6 +75,9 @@ void dc_conn_log(struct dc_context *ctx,
+ if (signal == signal_type_info_tbl[i].type)
+ break;
+
++ if (i == NUM_ELEMENTS(signal_type_info_tbl))
++ goto fail;
++
+ dm_logger_append(&entry, "[%s][ConnIdx:%d] ",
+ signal_type_info_tbl[i].name,
+ link->link_index);
+@@ -96,6 +99,8 @@ void dc_conn_log(struct dc_context *ctx,
+
+ dm_logger_append(&entry, "^\n");
+ dm_helpers_dc_conn_log(ctx, &entry, event);
++
++fail:
+ dm_logger_close(&entry);
+
+ va_end(args);
+diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+index aaaebd0..86e6438 100644
+--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
++++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+@@ -249,7 +249,7 @@ static enum bp_result bios_parser_get_dst_obj(struct dc_bios *dcb,
+ struct graphics_object_id *dest_object_id)
+ {
+ uint32_t number;
+- uint16_t *id;
++ uint16_t *id = NULL;
+ ATOM_OBJECT *object;
+ struct bios_parser *bp = BP_FROM_DCB(dcb);
+
+@@ -260,7 +260,7 @@ static enum bp_result bios_parser_get_dst_obj(struct dc_bios *dcb,
+
+ number = get_dest_obj_list(bp, object, &id);
+
+- if (number <= index)
++ if (number <= index || !id)
+ return BP_RESULT_BADINPUT;
+
+ *dest_object_id = object_id_from_bios_object_id(id[index]);
+diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
+index 81c40f8..0df9ecb 100644
+--- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
+@@ -352,11 +352,11 @@ void dce_aud_az_enable(struct audio *audio)
+ uint32_t value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL);
+
+ set_reg_field_value(value, 1,
+- AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL,
+- CLOCK_GATING_DISABLE);
+- set_reg_field_value(value, 1,
+- AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL,
+- AUDIO_ENABLED);
++ AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL,
++ CLOCK_GATING_DISABLE);
++ set_reg_field_value(value, 1,
++ AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL,
++ AUDIO_ENABLED);
+
+ AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, value);
+ value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL);
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
+index c40e81b..10cce51d 100644
+--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
+@@ -949,11 +949,13 @@ static struct pipe_ctx *dcn10_acquire_idle_pipe_for_layer(
+ struct pipe_ctx *head_pipe = resource_get_head_pipe_for_stream(res_ctx, stream);
+ struct pipe_ctx *idle_pipe = find_idle_secondary_pipe(res_ctx, pool);
+
+- if (!head_pipe)
++ if (!head_pipe) {
+ ASSERT(0);
++ return NULL;
++ }
+
+ if (!idle_pipe)
+- return false;
++ return NULL;
+
+ idle_pipe->stream = head_pipe->stream;
+ idle_pipe->stream_res.tg = head_pipe->stream_res.tg;
+--
+2.7.4
+