Fixes for the deferqueue_add() function
PATCH 1/1 Fixes for the deferqueue_add() function
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 :)
--- kernel/deferqueue.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
kernel/deferqueue.c +3 -2
@@ -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 ; }
Signature · 1 line
1.6.0.4
A message that is not in the archive (sent off-list or not yet received): 1245431791-17588-1-git-send-email-danms-r/[email protected]
Quoted 14 lines · Dan Smith
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 :)
Signed-off-by Dan Smith <danms-r/[email protected]>--- kernel/deferqueue.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)kernel/deferqueue.c +0
-0
kernel/deferqueue.c int deferqueue_add(struct deferqueue_head *head, void *data, int size, · line 69
Quoted 5 lines
kernel/deferqueue.c +1
-1@@ -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 );
huh. yeah.
kernel/deferqueue.c int deferqueue_add(struct deferqueue_head *head, void *data, int size, · line 75
Quoted 6 lines
kernel/deferqueue.c +1
-0if (!dq)return -ENOMEM ; dq->function = func; dq->destructor = dtor; +INIT_LIST_HEAD (&dq->list);
I'm pretty sure only head->list needed to be initialized.
kernel/deferqueue.c int deferqueue_add(struct deferqueue_head *head, void *data, int size, · line 81
Quoted 7 lines
kernel/deferqueue.c +1
-1memcpy (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);
at least after you've done this :)
Quoted 10 lines
kernel/deferqueue.c +0
-0spin_unlock (&head->lock);return 0 ; }Signature · 6 lines
1.6.0.4 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers
Quoted 1 line
kernel/deferqueue.c int deferqueue_add(struct deferqueue_head *head, void *data, int size, · line 75
Quoted 1 line
kernel/deferqueue.c +1
-0+INIT_LIST_HEAD (&dq->list);
SH> I'm pretty sure only head->list needed to be initialized.
Quoted 2 lines
kernel/deferqueue.c int deferqueue_add(struct deferqueue_head *head, void *data, int size, · line 81
Quoted 2 lines
kernel/deferqueue.c +1
-1-list_add_tail (&head->list, &dq->list); +list_add_tail (&dq->list, &head->list);
SH> at least after you've done this :)
Right, right, well, it was part of the process... :)
Signature · 3 lines
Dan Smith IBM Linux Technology Center email: danms-r/[email protected]