* [PATCH] drm: fix uninitialized acquire_ctx fields (v2)
@ 2014-06-07 14:55 Rob Clark
2014-06-18 11:12 ` Ville Syrjälä
0 siblings, 1 reply; 3+ messages in thread
From: Rob Clark @ 2014-06-07 14:55 UTC (permalink / raw)
To: dri-devel
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>
---
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_modeset_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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm: fix uninitialized acquire_ctx fields (v2)
2014-06-07 14:55 [PATCH] drm: fix uninitialized acquire_ctx fields (v2) Rob Clark
@ 2014-06-18 11:12 ` Ville Syrjälä
2014-06-23 9:02 ` Jani Nikula
0 siblings, 1 reply; 3+ messages in thread
From: Ville Syrjälä @ 2014-06-18 11:12 UTC (permalink / raw)
To: Rob Clark; +Cc: dri-devel
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älä <ville.syrjala@linux.intel.com>
> Signed-off-by: Rob Clark <robdclark@gmail.com>
I thought I already gave these. Well here they are again:
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> 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_modeset_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älä
Intel OTC
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm: fix uninitialized acquire_ctx fields (v2)
2014-06-18 11:12 ` Ville Syrjälä
@ 2014-06-23 9:02 ` Jani Nikula
0 siblings, 0 replies; 3+ messages in thread
From: Jani Nikula @ 2014-06-23 9:02 UTC (permalink / raw)
To: Ville Syrjälä, Rob Clark; +Cc: dri-devel
On Wed, 18 Jun 2014, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> 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älä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Rob Clark <robdclark@gmail.com>
>
> I thought I already gave these. Well here they are again:
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
https://bugzilla.kernel.org/show_bug.cgi?id=78401
>
>> ---
>> 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_modeset_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älä
> Intel OTC
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-23 9:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-07 14:55 [PATCH] drm: fix uninitialized acquire_ctx fields (v2) Rob Clark
2014-06-18 11:12 ` Ville Syrjälä
2014-06-23 9:02 ` Jani Nikula
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.