From: Rob Clark Date: Sat, 7 Jun 2014 14:55:39 +0000 (-0400) Subject: drm: fix uninitialized acquire_ctx fields (v2) X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c3e25ae34fab3557b17a585446b5576e49d2f203;p=openwrt%2Fstaging%2Fblogic.git drm: fix uninitialized acquire_ctx fields (v2) 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ä Signed-off-by: Rob Clark Reviewed-by: Ville Syrjälä Tested-by: Ville Syrjälä Signed-off-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c index 7c2497dea1e9..0dc57d5ecd10 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); }