Skip to content

Commit c3e25ae

Browse files
robclarkdanvet
authored andcommitted
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ä <ville.syrjala@linux.intel.com> Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 735b9ff commit c3e25ae

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/gpu/drm/drm_modeset_lock.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
6565
uint32_t flags)
6666
{
67+
memset(ctx, 0, sizeof(*ctx));
6768
ww_acquire_init(&ctx->ww_ctx, &crtc_ww_class);
6869
INIT_LIST_HEAD(&ctx->locked);
6970
}

0 commit comments

Comments
 (0)