From: kernel test robot <lkp@intel.com>
To: Hao Li <hao.li@linux.dev>
Cc: oe-kbuild-all@lists.linux.dev, Harry Yoo <harry@kernel.org>,
"Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Subject: [mm-slab:slab/for-next 1/2] mm/slab_common.c:1012 new_kmalloc_cache() warn: always true condition '(type >= 0) => (0-u32max >= 0)'
Date: Fri, 20 Nov 2026 15:32:41 +0100 [thread overview]
Message-ID: <20261120153115.isoaU88H-lkp@intel.com> (raw)
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
reply other threads:[~2026-11-20 14:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261120153115.isoaU88H-lkp@intel.com \
--to=lkp@intel.com \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.