All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [trace:probes/core 21/21] kernel/trace/trace_probe.c:361:14: warning: variable 'is_ptr' set but not used
Date: Tue, 14 Jul 2026 05:59:46 +0800	[thread overview]
Message-ID: <202607140501.lOrT6KpG-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace probes/core
head:   744d07442f343166a6eaee73361b039fa9ec5b7f
commit: 744d07442f343166a6eaee73361b039fa9ec5b7f [21/21] tracing/probes: Eliminate recursion in parse_probe_arg()
config: i386-randconfig-141-20260714 (https://download.01.org/0day-ci/archive/20260714/202607140501.lOrT6KpG-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9185-gbcc58b9c
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260714/202607140501.lOrT6KpG-lkp@intel.com/reproduce)

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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607140501.lOrT6KpG-lkp@intel.com/

All warnings (new ones prefixed by >>):

   kernel/trace/trace_probe.c: In function 'parse_this_cpu':
>> kernel/trace/trace_probe.c:361:14: warning: variable 'is_ptr' set but not used [-Wunused-but-set-variable]
     361 |         bool is_ptr = false;
         |              ^~~~~~


vim +/is_ptr +361 kernel/trace/trace_probe.c

2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  353) 
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  354) static int
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  355) parse_probe_arg(char *arg, const struct fetch_type *type,
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  356) 		struct fetch_insn **pcode, struct fetch_insn *end,
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  357) 		struct traceprobe_parse_context *ctx);
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  358) 
744d07442f3431 Masami Hiramatsu          2026-07-13  359  static int parse_this_cpu(char *arg, struct traceprobe_parse_context *ctx)
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  360) {
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02 @361) 	bool is_ptr = false;
744d07442f3431 Masami Hiramatsu          2026-07-13  362  	bool is_read = false;
744d07442f3431 Masami Hiramatsu          2026-07-13  363  	char *tmp;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  364) 
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  365) 	/*
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  366) 	 * This is only for kernel probes, excluding eprobe, because per-cpu
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  367) 	 * pointer should not be recorded by events.
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  368) 	 */
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  369) 	if (!(ctx->flags & TPARG_FL_KERNEL) ||
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  370) 	    (ctx->flags & TPARG_FL_TEVENT)) {
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  371) 		trace_probe_log_err(ctx->offset, NOSUP_PERCPU);
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  372) 		return -EINVAL;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  373) 	}
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  374) 	if (str_has_prefix(arg, THIS_CPU_PTR_PREFIX)) {
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  375) 		arg += THIS_CPU_PTR_LEN;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  376) 		ctx->offset += THIS_CPU_PTR_LEN;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  377) 		is_ptr = true;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  378) 	} else if (str_has_prefix(arg, THIS_CPU_READ_PREFIX)) {
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  379) 		arg += THIS_CPU_READ_LEN;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  380) 		ctx->offset += THIS_CPU_READ_LEN;
744d07442f3431 Masami Hiramatsu          2026-07-13  381  		is_read = true;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  382) 	} else
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  383) 		return -EINVAL;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  384) 
744d07442f3431 Masami Hiramatsu          2026-07-13  385  	tmp = strrchr(arg, ')');
744d07442f3431 Masami Hiramatsu          2026-07-13  386  	if (!tmp) {
744d07442f3431 Masami Hiramatsu          2026-07-13  387  		trace_probe_log_err(ctx->offset + strlen(arg),
744d07442f3431 Masami Hiramatsu          2026-07-13  388  					DEREF_OPEN_BRACE);
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  389) 		return -EINVAL;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  390) 	}
744d07442f3431 Masami Hiramatsu          2026-07-13  391  	*tmp = '\0';
744d07442f3431 Masami Hiramatsu          2026-07-13  392  
744d07442f3431 Masami Hiramatsu          2026-07-13  393  	ctx->stack[ctx->depth].type = STATE_DEREF;
744d07442f3431 Masami Hiramatsu          2026-07-13  394  	ctx->stack[ctx->depth].deref.deref = FETCH_OP_CPU_PTR;
744d07442f3431 Masami Hiramatsu          2026-07-13  395  	ctx->stack[ctx->depth].deref.offset = 0;
744d07442f3431 Masami Hiramatsu          2026-07-13  396  	ctx->stack[ctx->depth].deref.cur_offs = ctx->offset;
744d07442f3431 Masami Hiramatsu          2026-07-13  397  	ctx->stack[ctx->depth].deref.inner_arg = arg;
744d07442f3431 Masami Hiramatsu          2026-07-13  398  	ctx->stack[ctx->depth].deref.is_cpu_read = is_read;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  399) 	return 0;
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  400) }
2c84fb76749e66 Masami Hiramatsu (Google  2026-07-02  401) 

:::::: The code at line 361 was first introduced by commit
:::::: 2c84fb76749e66bfd95259930c8ed7bc29633aca tracing/probes: Add this_cpu_read() and this_cpu_ptr() dereference method to fetcharg

:::::: TO: Masami Hiramatsu (Google) <mhiramat@kernel.org>
:::::: CC: Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

             reply	other threads:[~2026-07-13 22:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 21:59 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-07-13 22:32 [trace:probes/core 21/21] kernel/trace/trace_probe.c:361:14: warning: variable 'is_ptr' set but not used kernel test robot

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=202607140501.lOrT6KpG-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=mhiramat@kernel.org \
    --cc=oe-kbuild-all@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.