drm: fix uninitialized acquire_ctx fields (v2)
Subsystems (2)
PATCH 1/1 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
--- 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 10 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.v2: now with extra brown paper bag
Reported-by Ville Syrjälä <[email protected]>Signed-off-by Rob Clark <[email protected]>
I thought I already gave these. Well here they are again:
Quoted 18 lines
--- 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 · 1 line
1.9.3
Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 7 lines · Ville Syrjälä
Quoted 6 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.
Quoted 8 lines
Quoted 4 lines
v2: now with extra brown paper bag
Reported-by Ville Syrjälä <[email protected]>Signed-off-by Rob Clark <[email protected]>I thought I already gave these. Well here they are again:
Reviewed-by Ville Syrjälä <[email protected]>Tested-by Ville Syrjälä <[email protected]>
https://bugzilla.kernel.org/show_bug.cgi?id=78401
Quoted 27 lines
Quoted 19 lines
--- 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 · 1 line
1.9.3Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel