From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH] drm: fix uninitialized acquire_ctx fields (v2) Date: Wed, 18 Jun 2014 14:12:38 +0300 Message-ID: <20140618111238.GN27580@intel.com> References: <1402152939-25485-1-git-send-email-robdclark@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 323A36E3B4 for ; Wed, 18 Jun 2014 04:12:42 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1402152939-25485-1-git-send-email-robdclark@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Rob Clark Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org 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=E4l=E4 > Signed-off-by: Rob Clark I thought I already gave these. Well here they are again: Reviewed-by: Ville Syrj=E4l=E4 Tested-by: Ville Syrj=E4l=E4 > --- > 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_mod= eset_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=E4l=E4 Intel OTC