drm/dp: Fix read pointer for drm_dp_downsteam_debug()
Subsystems (2)
PATCH 1/2 drm/dp: Fix read pointer for drm_dp_downsteam_debug()
Pass in the array and not a pointer to the array to drm_dp_dpcd_read().
--- drivers/gpu/drm/drm_dp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_helper.c +1 -1
@@ -591,7 +591,7 @@ void drm_dp_downstream_debug(struct seq_file *m,seq_printf (m,"\t\tHW: %d.%d\n" , (rev[0 ] &0xf0 ) >>4 , rev[0 ] &0xf ); - len =drm_dp_dpcd_read (aux,DP_BRANCH_SW_REV , &rev,2 ); + len =drm_dp_dpcd_read (aux,DP_BRANCH_SW_REV , rev,2 );if (len >0 )seq_printf (m,"\t\tSW: %d.%d\n" , rev[0 ], rev[1 ]);
Signature · 6 lines
2.13.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 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
--- drivers/gpu/drm/drm_dp_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_helper.c +2 -1
@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m,DP_DETAILED_CAP_INFO_AVAILABLE ;int clk;int bpc; -char id[6 ]; +char id[7 ];int len;uint8_t rev[2 ];int type = port_cap[0 ] &DP_DS_PORT_TYPE_MASK ;
@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m,seq_puts (m,"\t\tType: N/A\n" ); } +memset (id,0 ,sizeof (id));drm_dp_downstream_id (aux, id);seq_printf (m,"\t\tID: %s\n" , id);
Signature · 6 lines
2.13.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
Quoted 23 lines · Chris Wilson
Before we interpret
drm_dp_downstream_id()as a string, make sure it is NULL terminated, even whendrm_dp_downtsream_id()fails.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101660
Signed-off-by Chris Wilson <[email protected]>--- drivers/gpu/drm/drm_dp_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_dp_helper.c +1
-1@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m,DP_DETAILED_CAP_INFO_AVAILABLE ;int clk;int bpc; -char id[6 ]; +char id[7 ];int len;uint8_t rev[2 ];int type = port_cap[0 ] &DP_DS_PORT_TYPE_MASK ;
drivers/gpu/drm/drm_dp_helper.c void drm_dp_downstream_debug(struct seq_file *m, · line 588
Quoted 6 lines
drivers/gpu/drm/drm_dp_helper.c +1
-0@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m,seq_puts (m,"\t\tType: N/A\n" ); } +memset (id,0 ,sizeof (id));drm_dp_downstream_id (aux, id);seq_printf (m,"\t\tID: %s\n" , id);
although I'd probably have gone for checking the return value of drm_dp_downstream_id() and using %*pE format with strnlen for the length.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
Quoted 33 lines · Jani Nikula
Quoted 23 lines · Chris Wilson
Before we interpret
drm_dp_downstream_id()as a string, make sure it is NULL terminated, even whendrm_dp_downtsream_id()fails.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101660
Signed-off-by Chris Wilson <[email protected]>--- drivers/gpu/drm/drm_dp_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_dp_helper.c +1
-1@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m,DP_DETAILED_CAP_INFO_AVAILABLE ;int clk;int bpc; -char id[6 ]; +char id[7 ];int len;uint8_t rev[2 ];int type = port_cap[0 ] &DP_DS_PORT_TYPE_MASK ;drivers/gpu/drm/drm_dp_helper.c void drm_dp_downstream_debug(struct seq_file *m, · line 588
Quoted 6 lines
drivers/gpu/drm/drm_dp_helper.c +1
-0@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m,seq_puts (m,"\t\tType: N/A\n" ); } +memset (id,0 ,sizeof (id));drm_dp_downstream_id (aux, id);seq_printf (m,"\t\tID: %s\n" , id);Reviewed-by Jani Nikula <[email protected]>
Quoted 3 lines
although I'd probably have gone for checking the return value of
drm_dp_downstream_id()and using %*pE format with strnlen for the length.
And pushed both to drm-misc-fixes, thanks for the patches.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
In reply to Jani NikulaQuoting Jani Nikula (2017-07-21 08:22:27)
Quoted 33 lines · Chris Wilson
Quoted 23 lines
Before we interpret
drm_dp_downstream_id()as a string, make sure it is NULL terminated, even whendrm_dp_downtsream_id()fails.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101660
Signed-off-by Chris Wilson <[email protected]>--- drivers/gpu/drm/drm_dp_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_dp_helper.c +1
-1@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m,DP_DETAILED_CAP_INFO_AVAILABLE ;int clk;int bpc; -char id[6 ]; +char id[7 ];int len;uint8_t rev[2 ];int type = port_cap[0 ] &DP_DS_PORT_TYPE_MASK ;drivers/gpu/drm/drm_dp_helper.c void drm_dp_downstream_debug(struct seq_file *m, · line 588
Quoted 6 lines
drivers/gpu/drm/drm_dp_helper.c +1
-0@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m,seq_puts (m," Type: N/A\n" ); } +memset (id,0 ,sizeof (id));drm_dp_downstream_id (aux, id);seq_printf (m," ID: %s\n" , id);Reviewed-by Jani Nikula <[email protected]>
Quoted 3 lines
although I'd probably have gone for checking the return value of
drm_dp_downstream_id()and using %*pE format with strnlen for the length.
I'm also wondering if we should treat it as a string? Print hexadecimal
+ ascii? There's probably a printf specifier for that as well. -Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
Quoted 34 lines · Chris Wilson
Quoting Jani Nikula (2017-07-21 08:22:27)
Quoted 33 lines · Chris Wilson
Quoted 23 lines
Before we interpret
drm_dp_downstream_id()as a string, make sure it is NULL terminated, even whendrm_dp_downtsream_id()fails.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101660
Signed-off-by Chris Wilson <[email protected]>--- drivers/gpu/drm/drm_dp_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_dp_helper.c +1
-1@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m,DP_DETAILED_CAP_INFO_AVAILABLE ;int clk;int bpc; -char id[6 ]; +char id[7 ];int len;uint8_t rev[2 ];int type = port_cap[0 ] &DP_DS_PORT_TYPE_MASK ;drivers/gpu/drm/drm_dp_helper.c void drm_dp_downstream_debug(struct seq_file *m, · line 588
Quoted 6 lines
drivers/gpu/drm/drm_dp_helper.c +1
-0@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m,seq_puts (m," Type: N/A\n" ); } +memset (id,0 ,sizeof (id));drm_dp_downstream_id (aux, id);seq_printf (m," ID: %s\n" , id);Reviewed-by Jani Nikula <[email protected]>
Quoted 6 lines
Quoted 3 lines
although I'd probably have gone for checking the return value of
drm_dp_downstream_id()and using %*pE format with strnlen for the length.I'm also wondering if we should treat it as a string? Print hexadecimal
+ ascii? There's probably a printf specifier for that as well.
Missed your mail, pushed already. The rest is for another patch, another day.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 3 lines · Chris Wilson
Pass in the array and not a pointer to the array to
drm_dp_dpcd_read().Signed-off-by Chris Wilson <[email protected]>
Quoted 16 lines
--- drivers/gpu/drm/drm_dp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_dp_helper.c +1
-1@@ -591,7 +591,7 @@ void drm_dp_downstream_debug(struct seq_file *m,seq_printf (m,"\t\tHW: %d.%d\n" , (rev[0 ] &0xf0 ) >>4 , rev[0 ] &0xf ); - len =drm_dp_dpcd_read (aux,DP_BRANCH_SW_REV , &rev,2 ); + len =drm_dp_dpcd_read (aux,DP_BRANCH_SW_REV , rev,2 );if (len >0 )seq_printf (m,"\t\tSW: %d.%d\n" , rev[0 ], rev[1 ]);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel