Re: [PATCH] riscv: stacktrace: Add USER_STACKTRACE support

From: kernel test robot
Date: Sat Jun 01 2024 - 09:28:40 EST


Hi Jinjie,

kernel test robot noticed the following build warnings:

[auto build test WARNING on perf-tools-next/perf-tools-next]
[also build test WARNING on tip/perf/core perf-tools/perf-tools linus/master acme/perf/core v6.10-rc1 next-20240531]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Jinjie-Ruan/riscv-stacktrace-Add-USER_STACKTRACE-support/20240531-163624
base: https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next
patch link: https://lore.kernel.org/r/20240531083258.386709-1-ruanjinjie%40huawei.com
patch subject: [PATCH] riscv: stacktrace: Add USER_STACKTRACE support
config: riscv-randconfig-r061-20240601 (https://download.01.org/0day-ci/archive/20240601/202406012109.PDAjXm2i-lkp@xxxxxxxxx/config)
compiler: riscv64-linux-gcc (GCC) 13.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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406012109.PDAjXm2i-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> arch/riscv/kernel/stacktrace.c:188:16-18: WARNING !A || A && B is equivalent to !A || B

vim +188 arch/riscv/kernel/stacktrace.c

164
165 /*
166 * Get the return address for a single stackframe and return a pointer to the
167 * next frame tail.
168 */
169 static unsigned long unwind_user_frame(stack_trace_consume_fn consume_entry,
170 void *cookie, unsigned long fp,
171 unsigned long reg_ra)
172 {
173 struct stackframe buftail;
174 unsigned long ra = 0;
175 unsigned long __user *user_frame_tail =
176 (unsigned long __user *)(fp - sizeof(struct stackframe));
177
178 /* Check accessibility of one struct frame_tail beyond */
179 if (!access_ok(user_frame_tail, sizeof(buftail)))
180 return 0;
181 if (__copy_from_user_inatomic(&buftail, user_frame_tail,
182 sizeof(buftail)))
183 return 0;
184
185 ra = reg_ra ? : buftail.ra;
186
187 fp = buftail.fp;
> 188 if (!ra || (ra && !consume_entry(cookie, ra)))
189 return 0;
190
191 return fp;
192 }
193

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