Skip to contentSkip to conversation

drm: Initialize list in event->base.link

PATCH In review Stéphane Marchesin 3 participants 3 messages Jun 14, 2013 – Jun 16, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Initialize list in event->base.link

The structure was kzalloced, so prev == next == NULL by default which is invalid.

---
 drivers/gpu/drm/drm_irq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_irq.c +1 -0
index 8bcce78..143a311 100644
@@ -1158,6 +1158,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
 	e->event.base.length = sizeof e->event;
 	e->event.user_data = vblwait->request.signal;
 	e->base.event = &e->event.base;
+	INIT_LIST_HEAD(&e->base.link);
 	e->base.file_priv = file_priv;
 	e->base.destroy = (void (*) (struct drm_pending_event *)) kfree;
 
Signature · 6 lines
1.8.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 4 lines · Stéphane Marchesin

The structure was kzalloced, so prev == next == NULL by default which is invalid.

We do a list_add_tail which doesn't seem to care about unitizalized list items, and when removing it we also use list_del and not list_del_init. So I don't think we actually need this, neither for correctness nor for consitency. Or am I missing something?
-Daniel

Quoted 23 lines
---
 drivers/gpu/drm/drm_irq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_irq.c +1 -0
index 8bcce78..143a311 100644
@@ -1158,6 +1158,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
 	e->event.base.length = sizeof e->event;
 	e->event.user_data = vblwait->request.signal;
 	e->base.event = &e->event.base;
+	INIT_LIST_HEAD(&e->base.link);
 	e->base.file_priv = file_priv;
 	e->base.destroy = (void (*) (struct drm_pending_event *)) kfree;
 
Signature · 6 lines
1.8.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
maintainer
#2 lore raw
Quoted 10 lines · Daniel Vetter
Quoted 4 lines · Stéphane Marchesin

The structure was kzalloced, so prev == next == NULL by default which is invalid.

We do a list_add_tail which doesn't seem to care about unitizalized list items, and when removing it we also use list_del and not list_del_init. So I don't think we actually need this, neither for correctness nor for consitency. Or am I missing something?

I was going to say the same thing.

Dave.