All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org,
	Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: Re: [PATCH] drm/dp: Make space for null terminator in the	DP device ID char array
Date: Mon, 07 Nov 2016 21:16:44 +0200	[thread overview]
Message-ID: <874m3j85ib.fsf@intel.com> (raw)
In-Reply-To: <1478293580-7817-1-git-send-email-dhinakaran.pandiyan@intel.com>

On Fri, 04 Nov 2016, Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> wrote:
> The DP device identification string read from the DPCD registers is 6
> characters long at max. and we store it in a char array of the same length
> without space for the NULL terminator. Fix this by increasing the array
> size to 7 and initialize it to an empty string.
>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@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 3e6fe82..3a39312 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] = "";

Or use %*pE in the format string and provide the length.

BR,
Jani.

>  	int len;
>  	uint8_t rev[2];
>  	int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-11-07 19:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04 21:06 [PATCH] drm/dp: Make space for null terminator in the DP device ID char array Dhinakaran Pandiyan
2016-11-04 21:53 ` ✗ Fi.CI.BAT: failure for " Patchwork
2016-11-07 18:59 ` [PATCH] " Pandiyan, Dhinakaran
2016-11-07 19:16 ` Jani Nikula [this message]
2016-11-07 23:22   ` [PATCH v2] " Dhinakaran Pandiyan
2016-11-15  0:04     ` Pandiyan, Dhinakaran
2016-11-07 23:45 ` ✓ Fi.CI.BAT: success for drm/dp: Make space for null terminator in the DP device ID char array (rev2) Patchwork

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=874m3j85ib.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@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 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.