Skip to content

Commit 967003b

Browse files
icklejnikula
authored andcommitted
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
1 parent c11a93f commit 967003b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/gpu/drm/drm_dp_helper.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
544544
DP_DETAILED_CAP_INFO_AVAILABLE;
545545
int clk;
546546
int bpc;
547-
char id[6];
547+
char id[7];
548548
int len;
549549
uint8_t rev[2];
550550
int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
583583
seq_puts(m, "\t\tType: N/A\n");
584584
}
585585

586+
memset(id, 0, sizeof(id));
586587
drm_dp_downstream_id(aux, id);
587588
seq_printf(m, "\t\tID: %s\n", id);
588589

0 commit comments

Comments
 (0)