* [PATCH 1/2] drm/dp: Fix read pointer for drm_dp_downsteam_debug()
@ 2017-07-20 17:45 Chris Wilson
2017-07-20 17:45 ` [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id() Chris Wilson
2017-07-21 7:19 ` [PATCH 1/2] drm/dp: Fix read pointer for drm_dp_downsteam_debug() Jani Nikula
0 siblings, 2 replies; 7+ messages in thread
From: Chris Wilson @ 2017-07-20 17:45 UTC (permalink / raw)
To: dri-devel
Pass in the array and not a pointer to the array to drm_dp_dpcd_read().
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/drm_dp_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 213fb837e1c4..1d9e30f0dbf8 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -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]);
--
2.13.3
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
2017-07-20 17:45 [PATCH 1/2] drm/dp: Fix read pointer for drm_dp_downsteam_debug() Chris Wilson
@ 2017-07-20 17:45 ` Chris Wilson
2017-07-21 7:22 ` Jani Nikula
2017-07-21 7:19 ` [PATCH 1/2] drm/dp: Fix read pointer for drm_dp_downsteam_debug() Jani Nikula
1 sibling, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2017-07-20 17:45 UTC (permalink / raw)
To: dri-devel
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>
---
drivers/gpu/drm/drm_dp_helper.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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,
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);
--
2.13.3
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
2017-07-20 17:45 ` [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id() Chris Wilson
@ 2017-07-21 7:22 ` Jani Nikula
2017-07-21 14:51 ` Jani Nikula
2017-07-21 15:01 ` Chris Wilson
0 siblings, 2 replies; 7+ messages in thread
From: Jani Nikula @ 2017-07-21 7:22 UTC (permalink / raw)
To: Chris Wilson, dri-devel
On Thu, 20 Jul 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> 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>
> ---
> drivers/gpu/drm/drm_dp_helper.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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,
> 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);
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
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.
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
2017-07-21 7:22 ` Jani Nikula
@ 2017-07-21 14:51 ` Jani Nikula
2017-07-21 15:01 ` Chris Wilson
1 sibling, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2017-07-21 14:51 UTC (permalink / raw)
To: Chris Wilson, dri-devel
On Fri, 21 Jul 2017, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Thu, 20 Jul 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>> 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>
>> ---
>> drivers/gpu/drm/drm_dp_helper.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> 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,
>> 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);
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> 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.
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
2017-07-21 7:22 ` Jani Nikula
2017-07-21 14:51 ` Jani Nikula
@ 2017-07-21 15:01 ` Chris Wilson
2017-07-21 15:14 ` Jani Nikula
1 sibling, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2017-07-21 15:01 UTC (permalink / raw)
To: Jani Nikula, dri-devel
Quoting Jani Nikula (2017-07-21 08:22:27)
> On Thu, 20 Jul 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > 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>
> > ---
> > drivers/gpu/drm/drm_dp_helper.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > 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,
> > 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, " 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 <jani.nikula@intel.com>
>
> 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
2017-07-21 15:01 ` Chris Wilson
@ 2017-07-21 15:14 ` Jani Nikula
0 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2017-07-21 15:14 UTC (permalink / raw)
To: Chris Wilson, dri-devel
On Fri, 21 Jul 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Quoting Jani Nikula (2017-07-21 08:22:27)
>> On Thu, 20 Jul 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>> > 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>
>> > ---
>> > drivers/gpu/drm/drm_dp_helper.c | 3 ++-
>> > 1 file changed, 2 insertions(+), 1 deletion(-)
>> >
>> > 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,
>> > 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, " 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 <jani.nikula@intel.com>
>>
>> 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.
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] drm/dp: Fix read pointer for drm_dp_downsteam_debug()
2017-07-20 17:45 [PATCH 1/2] drm/dp: Fix read pointer for drm_dp_downsteam_debug() Chris Wilson
2017-07-20 17:45 ` [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id() Chris Wilson
@ 2017-07-21 7:19 ` Jani Nikula
1 sibling, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2017-07-21 7:19 UTC (permalink / raw)
To: Chris Wilson, dri-devel
On Thu, 20 Jul 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Pass in the array and not a pointer to the array to drm_dp_dpcd_read().
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/drm_dp_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 213fb837e1c4..1d9e30f0dbf8 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -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]);
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-07-21 15:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-20 17:45 [PATCH 1/2] drm/dp: Fix read pointer for drm_dp_downsteam_debug() Chris Wilson
2017-07-20 17:45 ` [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id() Chris Wilson
2017-07-21 7:22 ` Jani Nikula
2017-07-21 14:51 ` Jani Nikula
2017-07-21 15:01 ` Chris Wilson
2017-07-21 15:14 ` Jani Nikula
2017-07-21 7:19 ` [PATCH 1/2] drm/dp: Fix read pointer for drm_dp_downsteam_debug() Jani Nikula
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.