[vbabka:b4/objext_split 18/20] mm/slab_common.c:1005 new_kmalloc_cache() warn: bitwise AND condition is false here

kernel test robot <[email protected]> Sun, 26 Jul 2026 12:07:32 +0800
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
TO: "Vlastimil Babka (SUSE)" <[email protected]>
CC: Hao Li <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git b4/objext_split
head:   fdc90eeb9c4ea57fc40590b2e91edf1c7b7cd9e8
commit: ac8c98b4bf14cd70e9815db4d8fa54879b24fc91 [18/20] mm/slab: add cache_ and slab_needs_objcg() helpers
:::::: branch date: 34 hours ago
:::::: commit date: 35 hours ago
config: alpha-randconfig-r071-20260726 (https://download.01.org/0day-ci/archive/20260726/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 10.5.0
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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
mm/slab_common.c:1005 new_kmalloc_cache() warn: bitwise AND condition is false here

vim +1005 mm/slab_common.c

3c615294058429 GONG, Ruiqi            2023-07-14   992  
13e680fb6a1e77 Waiman Long            2021-06-28   993  	/*
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09   994) 	 * If memcg_kmem is enabled and this is a KMALLOC_NORMAL cache and not
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09   995) 	 * aliased with any other type, make sure it's never merged with any other
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09   996) 	 * cache.
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09   997) 	 *
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09   998) 	 * In other cases the kmalloc cache may end up being used for a
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09   999) 	 * __GFP_ACCOUNT allocation so mark it as such. The exception is a
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09  1000) 	 * KMALLOC_NO_OBJ_EXT cache.
13e680fb6a1e77 Waiman Long            2021-06-28  1001  	 */
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09  1002) 	if (!mem_cgroup_kmem_disabled()) {
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09  1003) 		if (type == KMALLOC_NORMAL && KMALLOC_RECLAIM != KMALLOC_NORMAL)
d5bf485746991c Vlastimil Babka        2023-06-13  1004  			flags |= SLAB_NO_MERGE;
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09 @1005) 		else if (!(flags & SLAB_NO_OBJ_EXT))
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09  1006) 			flags |= SLAB_MAY_ACCOUNT;
ac8c98b4bf14cd Vlastimil Babka (SUSE  2026-07-09  1007) 	}
d5bf485746991c Vlastimil Babka        2023-06-13  1008  
963e84b0f26229 Catalin Marinas        2023-06-12  1009  	if (minalign > ARCH_KMALLOC_MINALIGN) {
963e84b0f26229 Catalin Marinas        2023-06-12  1010  		aligned_size = ALIGN(aligned_size, minalign);
963e84b0f26229 Catalin Marinas        2023-06-12  1011  		aligned_idx = __kmalloc_index(aligned_size, false);
963e84b0f26229 Catalin Marinas        2023-06-12  1012  	}
963e84b0f26229 Catalin Marinas        2023-06-12  1013  
963e84b0f26229 Catalin Marinas        2023-06-12  1014  	if (!kmalloc_caches[type][aligned_idx])
963e84b0f26229 Catalin Marinas        2023-06-12  1015  		kmalloc_caches[type][aligned_idx] = create_kmalloc_cache(
963e84b0f26229 Catalin Marinas        2023-06-12  1016  					kmalloc_info[aligned_idx].name[type],
963e84b0f26229 Catalin Marinas        2023-06-12  1017  					aligned_size, flags);
963e84b0f26229 Catalin Marinas        2023-06-12  1018  	if (idx != aligned_idx)
963e84b0f26229 Catalin Marinas        2023-06-12  1019  		kmalloc_caches[type][idx] = kmalloc_caches[type][aligned_idx];
a9730fca9946f3 Christoph Lameter      2015-06-29  1020  }
a9730fca9946f3 Christoph Lameter      2015-06-29  1021  

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