kernel/trace/fgraph.c:253: warning: Function parameter or member 'retp' not described in 'ftrace_graph_ret_addr'

From: kernel test robot
Date: Thu Nov 30 2023 - 06:53:02 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3b47bc037bd44f142ac09848e8d3ecccc726be99
commit: 76b42b63ed0d004961097d3a3cd979129d4afd26 function_graph: Move ftrace_graph_ret_addr() to fgraph.c
date: 5 years ago
config: i386-buildonly-randconfig-006-20231101 (https://download.01.org/0day-ci/archive/20231130/202311301937.UkV28E7f-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/202311301937.UkV28E7f-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311301937.UkV28E7f-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

kernel/trace/fgraph.c:209:15: warning: no previous prototype for 'ftrace_return_to_handler' [-Wmissing-prototypes]
209 | unsigned long ftrace_return_to_handler(unsigned long frame_pointer)
| ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/fgraph.c:303:6: warning: no previous prototype for 'ftrace_graph_sleep_time_control' [-Wmissing-prototypes]
303 | void ftrace_graph_sleep_time_control(bool enable)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/fgraph.c:308:5: warning: no previous prototype for 'ftrace_graph_entry_stub' [-Wmissing-prototypes]
308 | int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
| ^~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/fgraph.c:315:25: warning: cast between incompatible function types from 'void (*)(long unsigned int, long unsigned int, struct ftrace_ops *, struct pt_regs *)' to 'void (*)(struct ftrace_graph_ret *)' [-Wcast-function-type]
315 | (trace_func_graph_ret_t)ftrace_stub;
| ^
kernel/trace/fgraph.c: In function 'unregister_ftrace_graph':
kernel/trace/fgraph.c:595:31: warning: cast between incompatible function types from 'void (*)(long unsigned int, long unsigned int, struct ftrace_ops *, struct pt_regs *)' to 'void (*)(struct ftrace_graph_ret *)' [-Wcast-function-type]
595 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
| ^
kernel/trace/fgraph.c:253: warning: Function parameter or member 'task' not described in 'ftrace_graph_ret_addr'
kernel/trace/fgraph.c:253: warning: Function parameter or member 'idx' not described in 'ftrace_graph_ret_addr'
kernel/trace/fgraph.c:253: warning: Function parameter or member 'ret' not described in 'ftrace_graph_ret_addr'
>> kernel/trace/fgraph.c:253: warning: Function parameter or member 'retp' not described in 'ftrace_graph_ret_addr'


vim +253 kernel/trace/fgraph.c

234
235 /**
236 * ftrace_graph_ret_addr - convert a potentially modified stack return address
237 * to its original value
238 *
239 * This function can be called by stack unwinding code to convert a found stack
240 * return address ('ret') to its original value, in case the function graph
241 * tracer has modified it to be 'return_to_handler'. If the address hasn't
242 * been modified, the unchanged value of 'ret' is returned.
243 *
244 * 'idx' is a state variable which should be initialized by the caller to zero
245 * before the first call.
246 *
247 * 'retp' is a pointer to the return address on the stack. It's ignored if
248 * the arch doesn't have HAVE_FUNCTION_GRAPH_RET_ADDR_PTR defined.
249 */
250 #ifdef HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
251 unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
252 unsigned long ret, unsigned long *retp)
> 253 {
254 int index = task->curr_ret_stack;
255 int i;
256
257 if (ret != (unsigned long)return_to_handler)
258 return ret;
259
260 if (index < 0)
261 return ret;
262
263 for (i = 0; i <= index; i++)
264 if (task->ret_stack[i].retp == retp)
265 return task->ret_stack[i].ret;
266
267 return ret;
268 }
269 #else /* !HAVE_FUNCTION_GRAPH_RET_ADDR_PTR */
270 unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
271 unsigned long ret, unsigned long *retp)
272 {
273 int task_idx;
274
275 if (ret != (unsigned long)return_to_handler)
276 return ret;
277
278 task_idx = task->curr_ret_stack;
279
280 if (!task->ret_stack || task_idx < *idx)
281 return ret;
282
283 task_idx -= *idx;
284 (*idx)++;
285
286 return task->ret_stack[task_idx].ret;
287 }
288 #endif /* HAVE_FUNCTION_GRAPH_RET_ADDR_PTR */
289

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