All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: pengdonglin <pengdonglin@xiaomi.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: [bug report] function_graph: Enable funcgraph-args and funcgraph-retaddr to work simultaneously
Date: Tue, 2 Dec 2025 11:32:26 +0300	[thread overview]
Message-ID: <aS6kGi0maWBl-MjZ@stanley.mountain> (raw)

Hello pengdonglin,

Commit f83ac7544fbf ("function_graph: Enable funcgraph-args and
funcgraph-retaddr to work simultaneously") from Nov 25, 2025
(linux-next), leads to the following Smatch static checker warning:

kernel/trace/trace_functions_graph.c:1033 print_graph_entry_nested() warn: unsigned 'call->depth' is never less than zero.
kernel/trace/trace_functions_graph.c:975 print_graph_entry_leaf() warn: unsigned 'call->depth' is never less than zero.
kernel/trace/trace.h:1130 ftrace_graph_ignore_func() warn: unsigned 'trace->depth' is never less than zero.

kernel/trace/trace_functions_graph.c
    1012 static enum print_line_t
    1013 print_graph_entry_nested(struct trace_iterator *iter,
    1014                          struct ftrace_graph_ent_entry *entry,
    1015                          struct trace_seq *s, int cpu, u32 flags)
    1016 {
    1017         struct ftrace_graph_ent *call = &entry->graph_ent;
    1018         struct fgraph_data *data = iter->private;
    1019         struct trace_array *tr = iter->tr;
    1020         unsigned long func;
    1021         int args_size;
    1022         int i;
    1023 
    1024         if (data) {
    1025                 struct fgraph_cpu_data *cpu_data;
    1026                 int cpu = iter->cpu;
    1027 
    1028                 cpu_data = per_cpu_ptr(data->cpu_data, cpu);
    1029                 cpu_data->depth = call->depth;
    1030 
    1031                 /* Save this function pointer to see if the exit matches */
    1032                 if (call->depth < FTRACE_RETFUNC_DEPTH &&
--> 1033                     !WARN_ON_ONCE(call->depth < 0))
                                           ^^^^^^^^^^^^^^^
The patch changed call->depth from int to unsigned long.

    1034                         cpu_data->enter_funcs[call->depth] = call->func;
    1035         }
    1036 
    1037         /* No time */
    1038         print_graph_duration(tr, 0, s, flags | FLAGS_FILL_FULL);

regards,
dan carpenter

             reply	other threads:[~2025-12-02  8:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02  8:32 Dan Carpenter [this message]
2026-01-02 18:56 ` [bug report] function_graph: Enable funcgraph-args and funcgraph-retaddr to work simultaneously Steven Rostedt
2026-01-02 18:58   ` Steven Rostedt

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=aS6kGi0maWBl-MjZ@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=pengdonglin@xiaomi.com \
    /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.