Distribution: fedora Hardware Environment: dell pentium 4 pc Software Environment: gcc Problem Description: the init_wait macro in <linux/wait.h> needs to parenthesize the uses of the argument 'wait' or compile errors and even unwanted side effects could occur Steps to reproduce a compile error wait_queue_t wq; wait_queue_t *pq; init_wait(&wq); // fails compilation because -> binds before & in this case init_wait((&wq)); // ok pq = &wq; init_wait(pq); // ok a side effect (and failure to properly init the wait) could conceivably occur if the wait_queue_t was in a higher level data structure and the operator binding just happened to resolve to a like variable name such as 'current' but not the right one, and no compile error is issued. this is more unlikely because all 3 variables would have to be there or at least one will complain.
ORIGINAL #define init_wait(wait) \ do { \ wait->task = current; \ wait->func = autoremove_wake_function; \ INIT_LIST_HEAD(&wait->task_list); \ } while (0) FIX #define init_wait(wait) \ do { \ (wait)->task = current; \ (wait)->func = autoremove_wake_function; \ INIT_LIST_HEAD(&(wait)->task_list); \ } while (0)
Andrew Morton plans to have a patch available in the post-2.6.10 timeframe. No bug left behind. :)
Patch has hit linus tree.