linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 6971/7658] mm/page_owner.c:860 stack_print() warn: unsigned 'nr_entries' is never less than zero.
@ 2024-02-16 14:26 kernel test robot
  2024-02-16 14:52 ` Oscar Salvador
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2024-02-16 14:26 UTC (permalink / raw)
  To: Oscar Salvador; +Cc: oe-kbuild-all, Linux Memory Management List, Andrew Morton

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@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402162252.FpEa3ZUY-lkp@intel.com/

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [linux-next:master 6971/7658] mm/page_owner.c:860 stack_print() warn: unsigned 'nr_entries' is never less than zero.
  2024-02-16 14:26 [linux-next:master 6971/7658] mm/page_owner.c:860 stack_print() warn: unsigned 'nr_entries' is never less than zero kernel test robot
@ 2024-02-16 14:52 ` Oscar Salvador
  0 siblings, 0 replies; 2+ messages in thread
From: Oscar Salvador @ 2024-02-16 14:52 UTC (permalink / raw)
  To: kernel test robot
  Cc: oe-kbuild-all, Linux Memory Management List, Andrew Morton

On Fri, Feb 16, 2024 at 10:26:36PM +0800, kernel test robot wrote:
> 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@intel.com/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@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202402162252.FpEa3ZUY-lkp@intel.com/

Thanks

>  > 860		if (!nr_entries || nr_entries < 0 ||

I'll add a fixup.

>    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
> 

-- 
Oscar Salvador
SUSE Labs


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-16 14:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 14:26 [linux-next:master 6971/7658] mm/page_owner.c:860 stack_print() warn: unsigned 'nr_entries' is never less than zero kernel test robot
2024-02-16 14:52 ` Oscar Salvador

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox