Re: [PATCH v4 2/3] mm, page_owner: Add page_owner_stacks file to print out only stacks and their counte

From: kernel test robot
Date: Sat Apr 22 2023 - 07:19:52 EST


Hi Oscar,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.3-rc7]
[cannot apply to akpm-mm/mm-everything next-20230421]
[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/Oscar-Salvador/lib-stackdepot-Add-a-refcount-field-in-stack_record/20230421-181709
base: linus/master
patch link: https://lore.kernel.org/r/20230421101415.5734-3-osalvador%40suse.de
patch subject: [PATCH v4 2/3] mm, page_owner: Add page_owner_stacks file to print out only stacks and their counte
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20230422/202304221906.CKlcyd2r-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304221906.CKlcyd2r-lkp@xxxxxxxxx/

smatch warnings:
lib/stackdepot.c:558 stack_print() warn: unsigned 'stack->size' is never less than zero.

vim +558 lib/stackdepot.c

551
552 int stack_print(struct seq_file *m, void *v)
553 {
554 char *buf;
555 int ret = 0;
556 struct stack_record *stack =v;
557
> 558 if (!stack->size || stack->size < 0 ||
559 stack->size > PAGE_SIZE || stack->handle.valid != 1 ||
560 refcount_read(&stack->count) < 1)
561 return 0;
562
563 buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
564 ret += stack_trace_snprint(buf, PAGE_SIZE, stack->entries, stack->size, 0);
565 scnprintf(buf + ret, PAGE_SIZE - ret, "stack count: %d\n\n",
566 refcount_read(&stack->count));
567 seq_printf(m, buf);
568 seq_puts(m, "\n\n");
569 kfree(buf);
570
571 return 0;
572 }
573 #endif
574

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