[GIT PULL] tracing: Use cpumask_available() to check if cpumask variable may be used

From: Steven Rostedt
Date: Tue May 09 2017 - 09:36:01 EST



Linus,

This is a trivial patch that changes a check for a cpumask from a NULL
pointer to using cpumask_available(), which will do the check. This is
because cpumasks when not allocated are always set, and clang complains
about it.

I was just recently pinged about this patch. It required
cpumask_available() to be in your tree first.

Please pull the latest trace-v4.12-3 tree, which can be found at:


git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v4.12-3

Tag SHA1: 7eae248e169b333baaec1abe2878dcb7f1de3eeb
Head SHA1: 4dbbe2d8e95c351157f292ece067f985c30c7b53


Matthias Kaehlcke (1):
tracing: Use cpumask_available() to check if cpumask variable may be used

----
kernel/trace/trace.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---------------------------
commit 4dbbe2d8e95c351157f292ece067f985c30c7b53
Author: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
Date: Fri Apr 21 16:41:10 2017 -0700

tracing: Use cpumask_available() to check if cpumask variable may be used

This fixes the following clang warning:

kernel/trace/trace.c:3231:12: warning: address of array 'iter->started'
will always evaluate to 'true' [-Wpointer-bool-conversion]
if (iter->started)

Link: http://lkml.kernel.org/r/20170421234110.117075-1-mka@xxxxxxxxxxxx

Signed-off-by: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 4ad4420b33d6..c4536c449021 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3311,13 +3311,14 @@ static void test_cpu_buff_start(struct trace_iterator *iter)
if (!(iter->iter_flags & TRACE_FILE_ANNOTATE))
return;

- if (iter->started && cpumask_test_cpu(iter->cpu, iter->started))
+ if (cpumask_available(iter->started) &&
+ cpumask_test_cpu(iter->cpu, iter->started))
return;

if (per_cpu_ptr(iter->trace_buffer->data, iter->cpu)->skipped_entries)
return;

- if (iter->started)
+ if (cpumask_available(iter->started))
cpumask_set_cpu(iter->cpu, iter->started);

/* Don't print started cpu buffer for the first entry of the trace */