dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/dp: Don't trust drm_dp_downstream_id()
Date: Fri, 21 Jul 2017 17:51:38 +0300	[thread overview]
Message-ID: <87shhpn8qt.fsf@intel.com> (raw)
In-Reply-To: <874lu6ntjg.fsf@intel.com>

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

  reply	other threads:[~2017-07-21 14:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shhpn8qt.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox