All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: kernel/trace/trace.c:2195 __ftrace_trace_stack() error: __builtin_memcpy() 'fstack->calls' too small (4096 vs u32max)
Date: Sat, 31 Oct 2026 11:06:18 +0100	[thread overview]
Message-ID: <202610311050.WdhCzroo-lkp@intel.com> (raw)

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Bill Wendling <morbo@google.com>
CC: Kees Cook <kees@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   36aad21d50d1af3f6954bb0c988257a908202477
commit: 2f70a9b7e9c74b92a85a2584090f0f5c4cbaa4be overflow: Match arithmetic in both parts of __builtin_choose_expr
date:   2 weeks ago
:::::: branch date: 5 hours ago
:::::: commit date: 2 weeks ago
config: um-randconfig-r2201-20261031 (https://download.01.org/0day-ci/archive/20261031/202610311050.WdhCzroo-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 2f70a9b7e9c7 ("overflow: Match arithmetic in both parts of __builtin_choose_expr")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202610311050.WdhCzroo-lkp@intel.com/

smatch warnings:
kernel/trace/trace.c:2195 __ftrace_trace_stack() error: __builtin_memcpy() 'fstack->calls' too small (4096 vs u32max)
drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c:132 mlxsw_sp_counter_pool_init() error: __builtin_memcpy() 'mlxsw_sp_counter_sub_pools' too small (80 vs u32max)
lib/stackdepot.c:471 depot_alloc_stack() error: __builtin_memcpy() 'stack->entries' too small (256 vs u32max)

vim +2195 kernel/trace/trace.c

6ce5a6f0a07d37 Tatsuya S                2024-10-21  2186  
3e9a8aadca4807 Steven Rostedt (Red Hat  2016-11-23  2187) 	event = __trace_buffer_lock_reserve(buffer, TRACE_STACK,
e7186af7fb2609 Steven Rostedt (Google   2023-07-13  2188) 				    struct_size(entry, caller, nr_entries),
9deb193af69d3f Steven Rostedt (VMware   2021-04-01  2189) 				    trace_ctx);
3928a8a2d98081 Steven Rostedt           2008-09-29  2190  	if (!event)
4a9bd3f134decd Steven Rostedt           2011-07-14  2191  		goto out;
e7186af7fb2609 Steven Rostedt (Google   2023-07-13  2192) 	entry = ring_buffer_event_data(event);
86387f7ee5d327 Ingo Molnar              2008-05-12  2193  
ee6dd0db4d8de4 Thomas Gleixner          2019-04-25  2194  	entry->size = nr_entries;
e7186af7fb2609 Steven Rostedt (Google   2023-07-13 @2195) 	memcpy(&entry->caller, fstack->calls,
e7186af7fb2609 Steven Rostedt (Google   2023-07-13  2196) 	       flex_array_size(entry, caller, nr_entries));
4a9bd3f134decd Steven Rostedt           2011-07-14  2197  
7ffbd48d5cab22 Steven Rostedt           2012-10-11  2198  	__buffer_unlock_commit(buffer, event);
4a9bd3f134decd Steven Rostedt           2011-07-14  2199  
4a9bd3f134decd Steven Rostedt           2011-07-14  2200   out:
4a9bd3f134decd Steven Rostedt           2011-07-14  2201  	/* Again, don't let gcc optimize things here */
4a9bd3f134decd Steven Rostedt           2011-07-14  2202  	barrier();
821465295b3613 Shan Wei                 2012-11-19  2203  	__this_cpu_dec(ftrace_stack_reserve);
5f1ef0dfcb5b7f Steven Rostedt           2026-01-05  2204  	trace_clear_recursion(bit);
86387f7ee5d327 Ingo Molnar              2008-05-12  2205  }
86387f7ee5d327 Ingo Molnar              2008-05-12  2206  

:::::: The code at line 2195 was first introduced by commit
:::::: e7186af7fb2609584a8bfb3da3c6ae09da5a5224 tracing: Add back FORTIFY_SOURCE logic to kernel_stack event structure

:::::: TO: Steven Rostedt (Google) <rostedt@goodmis.org>
:::::: CC: Steven Rostedt (Google) <rostedt@goodmis.org>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-10-31 10:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202610311050.WdhCzroo-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.