diff options
author | Tetsuo Handa <[email protected]> | 2014-12-05 21:22:22 +0900 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2015-01-14 13:34:15 +0100 |
commit | 1f8a7633094b7886c0677b78ba60b82e501f3ce6 (patch) | |
tree | 35b1e774960265e9463b4985dca4f09c3d2b9f26 /tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace | |
parent | a8b686b3af4419f92e0ea5be1c76fb68363df8e6 (diff) |
sched/debug: Fix potential call to __ffs(0) in sched_show_task()
"struct task_struct"->state is "volatile long" and __ffs() warns that
"Undefined if no bit exists, so code should check against 0 first."
Therefore, at expression
state = p->state ? __ffs(p->state) + 1 : 0;
in sched_show_task(), CPU might see "p->state" before "?" as "non-zero"
but "p->state" after "?" as "zero", which could result in
"state >= sizeof(stat_nam)" being true and bogus '?' is printed.
This patch changes "state" from "unsigned int" to "unsigned long" and
save "p->state" before calling __ffs(), in order to avoid potential call
to __ffs(0).
Signed-off-by: Tetsuo Handa <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Linus Torvalds <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
0 files changed, 0 insertions, 0 deletions