[linux-next:master 6971/7658] mm/page_owner.c:860 stack_print() warn: unsigned 'nr_entries' is never less than zero.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d37e1e4c52bc60578969f391fb81f947c3e83118
commit: 3a6bc36161369a1772af565b59c6e290ee189afc [6971/7658] mm,page_owner: display all stacks and their count
config: x86_64-randconfig-161-20240215 (https://download.01.org/0day-ci/archive/20240216/202402162252.FpEa3ZUY-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402162252.FpEa3ZUY-lkp@xxxxxxxxx/

smatch warnings:
mm/page_owner.c:860 stack_print() warn: unsigned 'nr_entries' is never less than zero.

vim +/nr_entries +860 mm/page_owner.c

   848	
   849	static int stack_print(struct seq_file *m, void *v)
   850	{
   851		int i;
   852		struct stack *stack = v;
   853		unsigned long *entries;
   854		unsigned long nr_entries;
   855		struct stack_record *stack_record = stack->stack_record;
   856	
   857		nr_entries = stack_record->size;
   858		entries = stack_record->entries;
   859	
 > 860		if (!nr_entries || nr_entries < 0 ||
   861		    refcount_read(&stack_record->count) < 2)
   862			return 0;
   863	
   864		for (i = 0; i < nr_entries; i++)
   865			seq_printf(m, " %pS\n", (void *)entries[i]);
   866		seq_printf(m, "stack_count: %d\n\n", refcount_read(&stack_record->count));
   867	
   868		return 0;
   869	}
   870	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux