dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Rob Clark" <robdclark@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: fix uninitialized acquire_ctx fields (v2)
Date: Mon, 23 Jun 2014 12:02:20 +0300	[thread overview]
Message-ID: <8738ew9exv.fsf@intel.com> (raw)
In-Reply-To: <20140618111238.GN27580@intel.com>

On Wed, 18 Jun 2014, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Sat, Jun 07, 2014 at 10:55:39AM -0400, Rob Clark wrote:
>> The acquire ctx will typically be declared on the stack, which means we
>> could have garbage values for any uninitialized field.  In this case, it
>> was triggering WARN_ON()s because 'contended' had garbage value.
>> 
>> Go ahead and use memset() to be more future-proof.
>> 
>> v2: now with extra brown paper bag
>> 
>> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Rob Clark <robdclark@gmail.com>
>
> I thought I already gave these. Well here they are again:
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

https://bugzilla.kernel.org/show_bug.cgi?id=78401

>
>> ---
>>  drivers/gpu/drm/drm_modeset_lock.c | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
>> index 7c2497d..0dc57d5 100644
>> --- a/drivers/gpu/drm/drm_modeset_lock.c
>> +++ b/drivers/gpu/drm/drm_modeset_lock.c
>> @@ -64,6 +64,7 @@
>>  void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
>>  		uint32_t flags)
>>  {
>> +	memset(ctx, 0, sizeof(*ctx));
>>  	ww_acquire_init(&ctx->ww_ctx, &crtc_ww_class);
>>  	INIT_LIST_HEAD(&ctx->locked);
>>  }
>> -- 
>> 1.9.3
>
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2014-06-23  9:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07 14:55 [PATCH] drm: fix uninitialized acquire_ctx fields (v2) Rob Clark
2014-06-18 11:12 ` Ville Syrjälä
2014-06-23  9:02   ` Jani Nikula [this message]

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=8738ew9exv.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robdclark@gmail.com \
    --cc=ville.syrjala@linux.intel.com \
    /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