intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Thulasimani, Sivakumar" <sivakumar.thulasimani@intel.com>
To: Imre Deak <imre.deak@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/4] drm/i915: Sanity check DP AUX message buffer and size
Date: Mon, 1 Feb 2016 11:42:54 +0530	[thread overview]
Message-ID: <56AEF766.7020403@intel.com> (raw)
In-Reply-To: <1454071949-24677-1-git-send-email-imre.deak@intel.com>



On 1/29/2016 6:22 PM, Imre Deak wrote:
> While we are calling intel_dp_aux_transfer() with msg->size=0 whenever
> msg->buffer is NULL, passing NULL to memcpy() is undefined according to
> the ISO C standard. I haven't found any notes about this in the GNU C's
> or the kernel's documentation of the function and can't imagine what it
> would do with the NULL ptr. To better document this use of the
> parameters it still make sense to add an explicit check for this to the
> code.
>
> Caught by Coverity.
can you share more info on when is this scenario triggered ?
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_dp.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index e2bea710..2aed36e 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -979,7 +979,10 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
>   		if (WARN_ON(txsize > 20))
>   			return -E2BIG;
>   
> -		memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size);
> +		if (msg->buffer)
> +			memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size);
> +		else
> +			WARN_ON(msg->size);
>   
>   		ret = intel_dp_aux_ch(intel_dp, txbuf, txsize, rxbuf, rxsize);
>   		if (ret > 0) {

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-02-01  6:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 12:52 [PATCH 1/4] drm/i915: Sanity check DP AUX message buffer and size Imre Deak
2016-01-29 12:52 ` [PATCH 2/4] drm/i915/chv: Fix error path in GPU freq helpers Imre Deak
2016-01-29 13:55   ` David Weinehall
2016-01-29 12:52 ` [PATCH 3/4] drm/i915: Add debug info for failed MSI enabling Imre Deak
2016-01-29 13:58   ` David Weinehall
2016-01-29 12:52 ` [PATCH 4/4] drm/i915: Properly terminate KMS mode name string during tv init Imre Deak
2016-01-29 14:00   ` David Weinehall
2016-01-29 13:04 ` ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915: Sanity check DP AUX message buffer and size Patchwork
2016-01-29 13:19 ` ✓ Fi.CI.BAT: success " Patchwork
2016-02-02 16:34   ` Imre Deak
2016-01-29 13:54 ` [PATCH 1/4] " David Weinehall
2016-02-01  6:12 ` Thulasimani, Sivakumar [this message]
2016-02-01 11:38   ` Imre Deak

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=56AEF766.7020403@intel.com \
    --to=sivakumar.thulasimani@intel.com \
    --cc=imre.deak@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).