Skip to contentSkip to conversation

2.6.5-rc2 __WAITQUEUE_INITIALIZER

PATCH In review Keith Owens 3 participants 4 messages Mar 29, 2004 – Apr 2, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.6.5-rc2 __WAITQUEUE_INITIALIZER

When struct __wait_queue is on stack or you reuse an existing waitqueue, you get garbage in the flags.

Index: 5-rc2.1/include/linux/wait.h

include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644) renamed from include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644) +1 -0
@@ -40,6 +40,7 @@ typedef struct __wait_queue_head wait_qu
  */
 
 #define __WAITQUEUE_INITIALIZER(name, tsk) {				\
+	.flags		= 0,						\
 	.task		= tsk,						\
 	.func		= default_wake_function,			\
 	.task_list	= { NULL, NULL } }
#1 lore raw
Quoted 8 lines · Keith Owens

When struct __wait_queue is on stack or you reuse an existing waitqueue, you get garbage in the flags.

Index: 5-rc2.1/include/linux/wait.h

include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644) typedef struct __wait_queue_head wait_qu · line 46

Quoted 7 lines
include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644) renamed from include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644) +1 -0
@@ -40,6 +40,7 @@ typedef struct __wait_queue_head wait_qu
  */
 
 #define __WAITQUEUE_INITIALIZER(name, tsk) {				\
+	.flags		= 0,						\
 	.task		= tsk,						\
 	.func		= default_wake_function,			\
 	.task_list	= { NULL, NULL } }

The compiler will do this for us?

#2 lore raw
Quoted 11 lines · Andrew Morton
Quoted 10 lines · Keith Owens

When struct __wait_queue is on stack or you reuse an existing waitqueue, you get garbage in the flags.

Index: 5-rc2.1/include/linux/wait.h

include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644) renamed from include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644) +0 -0
@@ -40,6 +40,7 @@ typedef struct __wait_queue_head wait_qu
  */
 
Quoted 7 lines

include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644) typedef struct __wait_queue_head wait_qu · line 46

Quoted 5 lines
include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644) renamed from include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644) +1 -0
 #define __WAITQUEUE_INITIALIZER(name, tsk) {				\
+	.flags		= 0,						\
 	.task		= tsk,						\
 	.func		= default_wake_function,			\
 	.task_list	= { NULL, NULL } }

The compiler will do this for us?

I thought I had a test case where the flags were not being set to 0, but cannot reproduce it. Ignore this patch unless I get some real evidence.

#3 lore raw
In reply to Andrew Morton
Quoted 9 lines
Quoted 9 lines

When struct __wait_queue is on stack or you reuse an existing waitqueue, you get garbage in the flags.

Index: 5-rc2.1/include/linux/wait.h

include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644) renamed from include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644) +0 -0
@@ -40,6 +40,7 @@ typedef struct __wait_queue_head wait_qu
  */
 
Quoted 7 lines

include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644) typedef struct __wait_queue_head wait_qu · line 46

Quoted 5 lines
include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644) renamed from include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644) +1 -0
 #define __WAITQUEUE_INITIALIZER(name, tsk) {				\
+	.flags		= 0,						\
 	.task		= tsk,						\
 	.func		= default_wake_function,			\
 	.task_list	= { NULL, NULL } }

The compiler will do this for us?

Yes, but only for statics (I believe).

Signature · 1 line
Tomas Szepe <[email protected]>