Skip to content

Commit

Permalink
stacktrace: Get rid of unneeded '!!' pattern
Browse files Browse the repository at this point in the history
My commit b0c51f1 ("stacktrace: Don't skip first entry on
noncurrent tasks") adds one or zero to skipnr by "!!(current == tsk)".

But the C99 standard says:

  The == (equal to) and != (not equal to) operators are
  ...
  Each of the operators yields 1 if the specified relation is true and 0
  if it is false.

So there is no need to prepend the above expression by "!!" -- remove it.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20191111092647.27419-1-jslaby@suse.cz
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Jiri Slaby authored and Ingo Molnar committed Nov 11, 2019
1 parent 31f4f5b commit 4b48512
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/stacktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ unsigned int stack_trace_save_tsk(struct task_struct *tsk, unsigned long *store,
.store = store,
.size = size,
/* skip this function if they are tracing us */
.skip = skipnr + !!(current == tsk),
.skip = skipnr + (current == tsk),
};

if (!try_get_task_stack(tsk))
Expand Down Expand Up @@ -300,7 +300,7 @@ unsigned int stack_trace_save_tsk(struct task_struct *task,
.entries = store,
.max_entries = size,
/* skip this function if they are tracing us */
.skip = skipnr + !!(current == task),
.skip = skipnr + (current == task),
};

save_stack_trace_tsk(task, &trace);
Expand Down

0 comments on commit 4b48512

Please sign in to comment.