Commit 967003bb authored by Chris Wilson's avatar Chris Wilson Committed by Jani Nikula

drm/dp: Don't trust drm_dp_downstream_id()

Before we interpret drm_dp_downstream_id() as a string, make sure it is
NULL terminated, even when drm_dp_downtsream_id() fails.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101660Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170720174532.23377-2-chris@chris-wilson.co.uk
parent c11a93f5
...@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m, ...@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
DP_DETAILED_CAP_INFO_AVAILABLE; DP_DETAILED_CAP_INFO_AVAILABLE;
int clk; int clk;
int bpc; int bpc;
char id[6]; char id[7];
int len; int len;
uint8_t rev[2]; uint8_t rev[2];
int type = port_cap[0] & DP_DS_PORT_TYPE_MASK; int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
...@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m, ...@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
seq_puts(m, "\t\tType: N/A\n"); seq_puts(m, "\t\tType: N/A\n");
} }
memset(id, 0, sizeof(id));
drm_dp_downstream_id(aux, id); drm_dp_downstream_id(aux, id);
seq_printf(m, "\t\tID: %s\n", id); seq_printf(m, "\t\tID: %s\n", id);
......
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