All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: rostedt@goodmis.org, mhiramat@kernel.org
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH] trace: Fix some checker warnings
Date: Thu, 01 Dec 2022 20:07:39 +0000	[thread overview]
Message-ID: <166992525941.1716618.13740663757583361463.stgit@warthog.procyon.org.uk> (raw)

Fix some checker warning in the trace code:

 (1) The declaration of tracing_max_lat_fops should be conditionally
     defined like its definition.

 (2) A number of trace functions, and their declarations where present,
     should have __printf attributes.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steven Rostedt <rostedt@goodmis.org>
cc: Masami Hiramatsu <mhiramat@kernel.org>
---

 include/linux/trace_events.h |    3 ++-
 include/linux/trace_seq.h    |    3 ++-
 kernel/trace/trace.c         |    2 ++
 kernel/trace/trace.h         |    2 +-
 kernel/trace/trace_output.c  |    5 +++--
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index 20749bd9db71..112b08ca2c5c 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -235,7 +235,8 @@ void tracing_record_taskinfo_sched_switch(struct task_struct *prev,
 void tracing_record_cmdline(struct task_struct *task);
 void tracing_record_tgid(struct task_struct *task);
 
-int trace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...);
+int trace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...)
+	 __printf(3, 4);
 
 struct event_filter;
 
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index 5a2c650d9e1c..0c4c7587d6c3 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -97,7 +97,8 @@ extern int trace_seq_hex_dump(struct trace_seq *s, const char *prefix_str,
 			      const void *buf, size_t len, bool ascii);
 
 #else /* CONFIG_TRACING */
-static inline void trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
+static inline __printf(2, 3)
+void trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
 {
 }
 static inline void
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 5cfc95a52bc3..9da61a54e187 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1692,7 +1692,9 @@ static ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt)
 }
 
 unsigned long __read_mostly	tracing_thresh;
+#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)
 static const struct file_operations tracing_max_lat_fops;
+#endif
 
 #ifdef LATENCY_FS_NOTIFY
 
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index d42e24507152..ecc6120116da 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -615,7 +615,7 @@ void trace_buffer_unlock_commit_nostack(struct trace_buffer *buffer,
 bool trace_is_tracepoint_string(const char *str);
 const char *trace_event_format(struct trace_iterator *iter, const char *fmt);
 void trace_check_vprintf(struct trace_iterator *iter, const char *fmt,
-			 va_list ap);
+			 va_list ap) __printf(2, 0);
 
 int trace_empty(struct trace_iterator *iter);
 
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 67f47ea27921..7039cd883c8b 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -323,8 +323,9 @@ void trace_event_printf(struct trace_iterator *iter, const char *fmt, ...)
 }
 EXPORT_SYMBOL(trace_event_printf);
 
-static int trace_output_raw(struct trace_iterator *iter, char *name,
-			    char *fmt, va_list ap)
+static __printf(3, 0)
+int trace_output_raw(struct trace_iterator *iter, char *name,
+		     char *fmt, va_list ap)
 {
 	struct trace_seq *s = &iter->seq;
 



             reply	other threads:[~2022-12-01 20:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 20:07 David Howells [this message]
2022-12-02 12:43 ` [PATCH] trace: Fix some checker warnings kernel test robot
2022-12-05  2:22   ` Masami Hiramatsu
2022-12-05  2:39     ` Steven Rostedt
2022-12-05  3:11       ` Masami Hiramatsu
2022-12-05  3:29         ` Steven Rostedt
2022-12-05  3:29       ` Masami Hiramatsu
2022-12-05  3:33         ` Steven Rostedt
2022-12-02 14:24 ` kernel test robot
2022-12-05  3:32 ` Masami Hiramatsu
2022-12-05  8:28 ` David Howells
2022-12-05  9:06   ` Masami Hiramatsu
2022-12-05 14:40     ` [PATCH] tracing: Fix complicated dependency of kernel test robot
2022-12-05 15:10     ` kernel test robot
2022-12-06 12:56       ` Masami Hiramatsu
2022-12-05 10:22   ` [PATCH] trace: Fix some checker warnings David Howells
2022-12-05 10:29   ` David Howells
2022-12-06 13:59     ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=166992525941.1716618.13740663757583361463.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.