Skip to contentSkip to conversation

kernel/trace/trace.c:6111 tracing_set_tracer() error: uninitialized symbol 'ret'.

PATCH kernel test robot 1 participant 1 message Dec 27, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

BCC: [email protected]
CC: [email protected]
TO: Steven Rostedt <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace trace/for-next
head:   cff6d93eab00bacf8b6bffdef775fc2de0273c96
commit: d33b10c0c73adca00f72bf4a153a07b7f5f34715 [1/15] tracing: Switch trace.c code over to use guard()

:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago
config: x86_64-randconfig-161-20241227 (https://download.01.org/0day-ci/archive/20241227/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
kernel/trace/trace.c:6111 tracing_set_tracer() error: uninitialized symbol 'ret'.

vim +/ret +6111 kernel/trace/trace.c

09d23a1d8a82e8 Steven Rostedt (Red Hat  2015-02-03  6072) 
9c5b9d3d65e485 Masami Hiramatsu         2020-01-11  6073  int tracing_set_tracer(struct trace_array *tr, const char *buf)
09d23a1d8a82e8 Steven Rostedt (Red Hat  2015-02-03  6074) {
bc0c38d139ec7f Steven Rostedt           2008-05-12  6075  	struct tracer *t;
12883efb670c28 Steven Rostedt (Red Hat  2013-03-05  6076) #ifdef CONFIG_TRACER_MAX_TRACE
34600f0e9c33c9 Steven Rostedt           2013-01-22  6077  	bool had_max_tr;
12883efb670c28 Steven Rostedt (Red Hat  2013-03-05  6078) #endif
d33b10c0c73adc Steven Rostedt           2024-12-24  6079  	int ret;
bc0c38d139ec7f Steven Rostedt           2008-05-12  6080  
d33b10c0c73adc Steven Rostedt           2024-12-24  6081  	guard(mutex)(&trace_types_lock);
1027fcb206a0fb Steven Rostedt           2009-03-12  6082  
7a1d1e4b9639ff Steven Rostedt (Google   2024-06-12  6083) 	update_last_data(tr);
7a1d1e4b9639ff Steven Rostedt (Google   2024-06-12  6084) 
a1f157c7a3bb34 Zheng Yejian             2023-09-06  6085  	if (!tr->ring_buffer_expanded) {
2b6080f28c7cc3 Steven Rostedt           2012-05-11  6086  		ret = __tracing_resize_ring_buffer(tr, trace_buf_size,
438ced1720b584 Vaibhav Nagarnaik        2012-02-02  6087  						RING_BUFFER_ALL_CPUS);
73c5162aa362a5 Steven Rostedt           2009-03-11  6088  		if (ret < 0)
d33b10c0c73adc Steven Rostedt           2024-12-24  6089  			return ret;
73c5162aa362a5 Steven Rostedt           2009-03-11  6090  		ret = 0;
73c5162aa362a5 Steven Rostedt           2009-03-11  6091  	}
73c5162aa362a5 Steven Rostedt           2009-03-11  6092  
bc0c38d139ec7f Steven Rostedt           2008-05-12  6093  	for (t = trace_types; t; t = t->next) {
bc0c38d139ec7f Steven Rostedt           2008-05-12  6094  		if (strcmp(t->name, buf) == 0)
bc0c38d139ec7f Steven Rostedt           2008-05-12  6095  			break;
bc0c38d139ec7f Steven Rostedt           2008-05-12  6096  	}
d33b10c0c73adc Steven Rostedt           2024-12-24  6097  	if (!t)
d33b10c0c73adc Steven Rostedt           2024-12-24  6098  		return -EINVAL;
d33b10c0c73adc Steven Rostedt           2024-12-24  6099  
2b6080f28c7cc3 Steven Rostedt           2012-05-11  6100  	if (t == tr->current_trace)
d33b10c0c73adc Steven Rostedt           2024-12-24  6101  		return 0;
bc0c38d139ec7f Steven Rostedt           2008-05-12  6102  
a35873a0993b4d Tom Zanussi              2019-02-13  6103  #ifdef CONFIG_TRACER_SNAPSHOT
a35873a0993b4d Tom Zanussi              2019-02-13  6104  	if (t->use_max_tr) {
c0a581d7126c0b Waiman Long              2022-09-22  6105  		local_irq_disable();
a35873a0993b4d Tom Zanussi              2019-02-13  6106  		arch_spin_lock(&tr->max_lock);
a35873a0993b4d Tom Zanussi              2019-02-13  6107  		if (tr->cond_snapshot)
a35873a0993b4d Tom Zanussi              2019-02-13  6108  			ret = -EBUSY;
a35873a0993b4d Tom Zanussi              2019-02-13  6109  		arch_spin_unlock(&tr->max_lock);
c0a581d7126c0b Waiman Long              2022-09-22  6110  		local_irq_enable();
a35873a0993b4d Tom Zanussi              2019-02-13 @6111  		if (ret)
d33b10c0c73adc Steven Rostedt           2024-12-24  6112  			return ret;
a35873a0993b4d Tom Zanussi              2019-02-13  6113  	}
a35873a0993b4d Tom Zanussi              2019-02-13  6114  #endif
c7b3ae0bd2ca65 Ziqian SUN (Zamir        2017-09-11  6115) 	/* Some tracers won't work on kernel command line */
c7b3ae0bd2ca65 Ziqian SUN (Zamir        2017-09-11  6116) 	if (system_state < SYSTEM_RUNNING && t->noboot) {
c7b3ae0bd2ca65 Ziqian SUN (Zamir        2017-09-11  6117) 		pr_warn("Tracer '%s' is not allowed on command line, ignored\n",
c7b3ae0bd2ca65 Ziqian SUN (Zamir        2017-09-11  6118) 			t->name);
d33b10c0c73adc Steven Rostedt           2024-12-24  6119  		return 0;
c7b3ae0bd2ca65 Ziqian SUN (Zamir        2017-09-11  6120) 	}
c7b3ae0bd2ca65 Ziqian SUN (Zamir        2017-09-11  6121) 
607e2ea167e56d Steven Rostedt (Red Hat  2013-11-06  6122) 	/* Some tracers are only allowed for the top level buffer */
d33b10c0c73adc Steven Rostedt           2024-12-24  6123  	if (!trace_ok_for_array(t, tr))
d33b10c0c73adc Steven Rostedt           2024-12-24  6124  		return -EINVAL;
607e2ea167e56d Steven Rostedt (Red Hat  2013-11-06  6125) 
cf6ab6d9143b15 Steven Rostedt (Red Hat  2014-12-15  6126) 	/* If trace pipe files are being read, we can't change the tracer */
d33b10c0c73adc Steven Rostedt           2024-12-24  6127  	if (tr->trace_ref)
d33b10c0c73adc Steven Rostedt           2024-12-24  6128  		return -EBUSY;
cf6ab6d9143b15 Steven Rostedt (Red Hat  2014-12-15  6129) 
9f029e83e968e5 Steven Rostedt           2008-11-12  6130  	trace_branch_disable();
613f04a0f51e6e Steven Rostedt (Red Hat  2013-03-14  6131) 
50512ab576e1ce Steven Rostedt (Red Hat  2014-01-14  6132) 	tr->current_trace->enabled--;
613f04a0f51e6e Steven Rostedt (Red Hat  2013-03-14  6133) 
2b6080f28c7cc3 Steven Rostedt           2012-05-11  6134  	if (tr->current_trace->reset)
2b6080f28c7cc3 Steven Rostedt           2012-05-11  6135  		tr->current_trace->reset(tr);
613f04a0f51e6e Steven Rostedt (Red Hat  2013-03-14  6136) 

:::::: The code at line 6111 was first introduced by commit
:::::: a35873a0993b4d38b40871f10fa4356c088c7140 tracing: Add conditional snapshot

:::::: TO: Tom Zanussi <[email protected]> :::::: CC: Steven Rostedt (VMware) <[email protected]>

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