Skip to contentSkip to conversation

timer: Add parenthesis around timer_setup() macro arguments

PATCH In review Kees Cook 3 participants 5 messages Nov 1, 2017 – Nov 2, 2017 High-resolution timers, timer wheel, clockevents

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 timer: Add parenthesis around timer_setup() macro arguments

In the case where expressions are passed as macro arguments, the LOCKDEP version of the timer macros need enclosing parenthesis.

---
 include/linux/timer.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
include/linux/timer.h +5 -4
index 09950482309b..a1af92bac0d5 100644
@@ -173,11 +173,12 @@ static inline void timer_setup_on_stack(struct timer_list *timer,
  * do want to keep the inline for argument type checking, though.
  */
 # define timer_setup(timer, callback, flags)				\
-		__setup_timer(timer, (TIMER_FUNC_TYPE)callback,		\
-			      (TIMER_DATA_TYPE)timer, flags)
+		__setup_timer((timer), (TIMER_FUNC_TYPE)(callback),	\
+			      (TIMER_DATA_TYPE)(timer), (flags))
 # define timer_setup_on_stack(timer, callback, flags)			\
-		__setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback,\
-				       (TIMER_DATA_TYPE)timer, flags)
+		__setup_timer_on_stack((timer),				\
+				       (TIMER_FUNC_TYPE)(callback),	\
+				       (TIMER_DATA_TYPE)(timer), (flags))
 #endif
 
 #define from_timer(var, callback_timer, timer_fieldname) \
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security
#1 lore raw
timer: Add parenthesis around timer_setup() macro arguments
Commit-ID:  00ed87da35e88a7a4d7f41673beab52ef828f12b
Gitweb:     https://git.kernel.org/tip/00ed87da35e88a7a4d7f41673beab52ef828f12b
Author:     Kees Cook <[email protected]>
AuthorDate: Wed, 1 Nov 2017 07:32:50 -0700
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 1 Nov 2017 19:05:05 +0100

timer: Add parenthesis around timer_setup() macro arguments

In the case where expressions are passed as macro arguments, the LOCKDEP version of the timer macros need enclosing parenthesis.

---
 include/linux/timer.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
include/linux/timer.h +5 -4
index 0995048..a1af92b 100644
@@ -173,11 +173,12 @@ static inline void timer_setup_on_stack(struct timer_list *timer,
  * do want to keep the inline for argument type checking, though.
  */
 # define timer_setup(timer, callback, flags)				\
-		__setup_timer(timer, (TIMER_FUNC_TYPE)callback,		\
-			      (TIMER_DATA_TYPE)timer, flags)
+		__setup_timer((timer), (TIMER_FUNC_TYPE)(callback),	\
+			      (TIMER_DATA_TYPE)(timer), (flags))
 # define timer_setup_on_stack(timer, callback, flags)			\
-		__setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback,\
-				       (TIMER_DATA_TYPE)timer, flags)
+		__setup_timer_on_stack((timer),				\
+				       (TIMER_FUNC_TYPE)(callback),	\
+				       (TIMER_DATA_TYPE)(timer), (flags))
 #endif
 
 #define from_timer(var, callback_timer, timer_fieldname) \
#2 lore raw
In reply to Kees Cook

Hi Kees,

Quoted 6 lines · On Wed, 1 Nov 2017 07:32:50 -0700 Kees Cook <[email protected]> wrote:

In the case where expressions are passed as macro arguments, the LOCKDEP version of the timer macros need enclosing parenthesis.

I have applied that patch to linux-next today pending it appearing in the tip tree.

Signature · 2 lines
Cheers,
Stephen Rothwell
author
#3 lore raw
Quoted 4 lines · Stephen Rothwell

Hi Kees,

Quoted 1 line · On Wed, 1 Nov 2017 07:32:50 -0700 Kees Cook <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines

In the case where expressions are passed as macro arguments, the LOCKDEP version of the timer macros need enclosing parenthesis.

I have applied that patch to linux-next today pending it appearing in the tip tree.

Thanks! It should be there in tip/timers/core as of several hours ago.

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
#4 lore raw

Hi Kees,

Quoted 9 lines · On Wed, 1 Nov 2017 20:04:05 -0700 Kees Cook <[email protected]> wrote:
Quoted 7 lines · Stephen Rothwell

Hi Kees,

Quoted 4 lines · On Wed, 1 Nov 2017 07:32:50 -0700 Kees Cook <[email protected]> wrote:

In the case where expressions are passed as macro arguments, the LOCKDEP version of the timer macros need enclosing parenthesis.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I have applied that patch to linux-next today pending it appearing in the tip tree.

Thanks! It should be there in tip/timers/core as of several hours ago.

Yeah, but there is some testing done before it is included the auto-latest branch, which is what I fetch for linux-next.

Signature · 2 lines
Cheers,
Stephen Rothwell