All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fixes for the deferqueue_add() function
@ 2009-06-19 17:16 Dan Smith
       [not found] ` <1245431791-17588-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Smith @ 2009-06-19 17:16 UTC (permalink / raw)
  To: containers-qjLDD68F18O7TbgM5vRIOg

I'm not sure how the deferqueue would (or has ever) worked without these
modifications, but I had to make them in order to use it :)

Cc: orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org
Signed-off-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 kernel/deferqueue.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/deferqueue.c b/kernel/deferqueue.c
index efd99d5..470b8a3 100644
--- a/kernel/deferqueue.c
+++ b/kernel/deferqueue.c
@@ -66,18 +66,19 @@ int deferqueue_add(struct deferqueue_head *head, void *data, int size,
 {
 	struct deferqueue_entry *dq;
 
-	dq = kmalloc(sizeof(dq) + size, GFP_KERNEL);
+	dq = kmalloc(sizeof(*dq) + size, GFP_KERNEL);
 	if (!dq)
 		return -ENOMEM;
 
 	dq->function = func;
 	dq->destructor = dtor;
+	INIT_LIST_HEAD(&dq->list);
 	memcpy(dq->data, data, size);
 
 	pr_debug("%s: adding work %p func %p dtor %p\n",
 		 __func__, dq, func, dtor);
 	spin_lock(&head->lock);
-	list_add_tail(&head->list, &dq->list);
+	list_add_tail(&dq->list, &head->list);
 	spin_unlock(&head->lock);
 	return 0;
 }
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-19 18:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-19 17:16 [PATCH] Fixes for the deferqueue_add() function Dan Smith
     [not found] ` <1245431791-17588-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-06-19 17:56   ` Serge E. Hallyn
2009-06-19 18:16     ` Dan Smith

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.