drm: fix uninitialized acquire_ctx fields
Subsystems (2)
PATCH 1/1 drm: fix uninitialized acquire_ctx fields
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.
Reported-by Ville Syrjälä <[email protected]>
Signed-off-by Rob Clark <[email protected]>
--- drivers/gpu/drm/drm_modeset_lock.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_modeset_lock.c +1 -0
@@ -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); }
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 17 lines · Rob Clark
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.Reported-by Ville Syrjälä <[email protected]>Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/drm_modeset_lock.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/drm_modeset_lock.c +0
-0
drivers/gpu/drm/drm_modeset_lock.c line 67
Quoted 4 lines
drivers/gpu/drm/drm_modeset_lock.c +1
-0@@ -64,6 +64,7 @@void drm_modeset_acquire_init (struct drm_modeset_acquire_ctx *ctx,uint32_t flags) { +memset (ctx,0 ,sizeof (ctx));
^^^
*ctx
with that fixed:
Reviewed-by Ville Syrjälä <[email protected]>
Tested-by Ville Syrjälä <[email protected]>
Quoted 5 lines
drivers/gpu/drm/drm_modeset_lock.c +0
-0ww_acquire_init (&ctx->ww_ctx, &crtc_ww_class);INIT_LIST_HEAD (&ctx->locked); }Signature · 1 line
1.9.3
Signature · 2 lines
Ville Syrjälä Intel OTC