All of lore.kernel.org
 help / color / mirror / Atom feed
* [mm-slab:slab/for-next 1/2] mm/slab_common.c:1012 new_kmalloc_cache() warn: always true condition '(type >= 0) => (0-u32max >= 0)'
@ 2026-11-20 14:32 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-11-20 14:32 UTC (permalink / raw)
  To: Hao Li; +Cc: oe-kbuild-all, Harry Yoo, Vlastimil Babka (SUSE)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mm/slab.git slab/for-next
head:   c6e6bf9b097d69a06974b2f8b5400b33e1faeb31
commit: ec81fa8f7dbcf89d9b4112544f76f47c8eb5c725 [1/2] mm/slab: don't set SLAB_MAY_ACCOUNT for KMALLOC_PARTITION_CACHES
config: um-randconfig-2200-20261120 (https://download.01.org/0day-ci/archive/20261120/20261120153115.isoaU88H-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 8db60b003f961f25c5cafe91ee44176f61374279)
smatch: v0.5.0-9187-g5189e3fb

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/20261120153115.isoaU88H-lkp@intel.com/

smatch warnings:
mm/slab_common.c:1012 new_kmalloc_cache() warn: always true condition '(type >= 0) => (0-u32max >= 0)'

vim +1012 mm/slab_common.c

  1001	
  1002		/*
  1003		 * If memcg_kmem is enabled and this is a KMALLOC_NORMAL or
  1004		 * KMALLOC_PARTITION_CACHES cache and not aliased with any other type,
  1005		 * make sure it's never merged with any other cache.
  1006		 *
  1007		 * In other cases the kmalloc cache may end up being used for a
  1008		 * __GFP_ACCOUNT allocation so mark it as such. The exception is a
  1009		 * KMALLOC_NO_OBJ_EXT cache.
  1010		 */
  1011		if (!mem_cgroup_kmem_disabled()) {
> 1012			if (type >= KMALLOC_PARTITION_START &&
  1013			    type <= KMALLOC_PARTITION_END &&
  1014			    KMALLOC_RECLAIM != KMALLOC_NORMAL)
  1015				flags |= SLAB_NO_MERGE;
  1016			else if (!(flags & SLAB_NO_OBJ_EXT))
  1017				flags |= SLAB_MAY_ACCOUNT;
  1018		}
  1019	
  1020		if (minalign > ARCH_KMALLOC_MINALIGN) {
  1021			aligned_size = ALIGN(aligned_size, minalign);
  1022			aligned_idx = __kmalloc_index(aligned_size, false);
  1023		}
  1024	
  1025		if (!kmalloc_caches[type][aligned_idx])
  1026			kmalloc_caches[type][aligned_idx] = create_kmalloc_cache(
  1027						kmalloc_info[aligned_idx].name[type],
  1028						aligned_size, flags);
  1029		if (idx != aligned_idx)
  1030			kmalloc_caches[type][idx] = kmalloc_caches[type][aligned_idx];
  1031	}
  1032	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-20 14:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 14:32 [mm-slab:slab/for-next 1/2] mm/slab_common.c:1012 new_kmalloc_cache() warn: always true condition '(type >= 0) => (0-u32max >= 0)' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.