aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-07-20 13:45:32 -0400
committerJani Nikula <jani.nikula@intel.com>2017-07-21 10:45:26 -0400
commit967003bb2cae121d345fd807eb757d9422229713 (patch)
tree1cf7ce3b548fd15af9c564d7bd2c0a5d6306ce99
parentc11a93f5fd9229dc7c8b90570c75cf70bc3976c2 (diff)
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=101660 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20170720174532.23377-2-chris@chris-wilson.co.uk
-rw-r--r--drivers/gpu/drm/drm_dp_helper.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 1d9e30f0dbf8..08af8d6b844b 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
544 DP_DETAILED_CAP_INFO_AVAILABLE; 544 DP_DETAILED_CAP_INFO_AVAILABLE;
545 int clk; 545 int clk;
546 int bpc; 546 int bpc;
547 char id[6]; 547 char id[7];
548 int len; 548 int len;
549 uint8_t rev[2]; 549 uint8_t rev[2];
550 int type = port_cap[0] & DP_DS_PORT_TYPE_MASK; 550 int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
583 seq_puts(m, "\t\tType: N/A\n"); 583 seq_puts(m, "\t\tType: N/A\n");
584 } 584 }
585 585
586 memset(id, 0, sizeof(id));
586 drm_dp_downstream_id(aux, id); 587 drm_dp_downstream_id(aux, id);
587 seq_printf(m, "\t\tID: %s\n", id); 588 seq_printf(m, "\t\tID: %s\n", id);
588 589