All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [harry:b4/memalloc-prof-dont-waste-slabobj-ext-metadata 18/18] mm/slab_common.c:362 __kmem_cache_create_args() warn: bitwise AND condition is false here
Date: Thu, 22 Oct 2026 11:57:40 +0200	[thread overview]
Message-ID: <202610221102.1ITKXBWg-lkp@intel.com> (raw)

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: "Harry Yoo (Meta)" <harry@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/harry/linux.git b4/memalloc-prof-dont-waste-slabobj-ext-metadata
head:   4eb758f1c30dafac114e68279058434bf6e617d9
commit: 4eb758f1c30dafac114e68279058434bf6e617d9 [18/18] mm/slab: do not set SLAB_MAY_ACCOUNT for all caches
:::::: branch date: 22 hours ago
:::::: commit date: 22 hours ago
config: xtensa-randconfig-r2201-20261022 (https://download.01.org/0day-ci/archive/20261022/202610221102.1ITKXBWg-lkp@intel.com/config)
compiler: xtensa-linux-gcc (GCC) 12.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 <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202610221102.1ITKXBWg-lkp@intel.com/

New smatch warnings:
mm/slab_common.c:362 __kmem_cache_create_args() warn: bitwise AND condition is false here

Old smatch warnings:
arch/xtensa/include/asm/thread_info.h:97 current_thread_info() warn: inconsistent indenting

vim +362 mm/slab_common.c

afe0c26d1968fe Vlastimil Babka        2021-05-14  342  
aff8518575715b Vlastimil Babka        2026-01-23  343  	/*
aff8518575715b Vlastimil Babka        2026-01-23  344  	 * Caches with specific capacity are special enough. It's simpler to
aff8518575715b Vlastimil Babka        2026-01-23  345  	 * make them unmergeable.
aff8518575715b Vlastimil Babka        2026-01-23  346  	 */
aff8518575715b Vlastimil Babka        2026-01-23  347  	if (args->sheaf_capacity)
aff8518575715b Vlastimil Babka        2026-01-23  348  		flags |= SLAB_NO_MERGE;
aff8518575715b Vlastimil Babka        2026-01-23  349  
b920536aa0a4fd Pekka Enberg           2012-08-16  350  	mutex_lock(&slab_mutex);
686d550d222e8f Christoph Lameter      2012-09-05  351  
879fb3c274c12c Christian Brauner      2024-09-05  352  	err = kmem_cache_sanity_check(name, object_size);
3aa24f519e48e0 Andrew Morton          2014-10-09  353  	if (err) {
3965fc36522446 Vladimir Davydov       2014-01-23  354  		goto out_unlock;
3aa24f519e48e0 Andrew Morton          2014-10-09  355  	}
686d550d222e8f Christoph Lameter      2012-09-05  356  
e70954fd6d4b46 Thomas Garnier         2016-12-12  357  	if (flags & ~SLAB_FLAGS_PERMITTED) {
e70954fd6d4b46 Thomas Garnier         2016-12-12  358  		err = -EINVAL;
e70954fd6d4b46 Thomas Garnier         2016-12-12  359  		goto out_unlock;
e70954fd6d4b46 Thomas Garnier         2016-12-12  360  	}
e70954fd6d4b46 Thomas Garnier         2016-12-12  361  
4eb758f1c30daf Harry Yoo (Meta        2026-10-14 @362) 	if (flags & SLAB_ACCOUNT)
7def2e8549e518 Vlastimil Babka (SUSE  2026-07-27  363) 		flags |= SLAB_MAY_ACCOUNT;
4eb758f1c30daf Harry Yoo (Meta        2026-10-14  364) 	if (mem_cgroup_kmem_disabled())
4eb758f1c30daf Harry Yoo (Meta        2026-10-14  365) 		flags &= ~SLAB_MAY_ACCOUNT;
7def2e8549e518 Vlastimil Babka (SUSE  2026-07-27  366) 
8eb8284b412906 David Windsor          2017-06-10  367  	/* Fail closed on bad usersize of useroffset values. */
346907ceb9d11b Vlastimil Babka        2022-11-16  368  	if (!IS_ENABLED(CONFIG_HARDENED_USERCOPY) ||
879fb3c274c12c Christian Brauner      2024-09-05  369  	    WARN_ON(!args->usersize && args->useroffset) ||
879fb3c274c12c Christian Brauner      2024-09-05  370  	    WARN_ON(object_size < args->usersize ||
879fb3c274c12c Christian Brauner      2024-09-05  371  		    object_size - args->usersize < args->useroffset))
879fb3c274c12c Christian Brauner      2024-09-05  372  		args->usersize = args->useroffset = 0;
879fb3c274c12c Christian Brauner      2024-09-05  373  
8598351edc42f3 Vlastimil Babka        2026-01-23  374  	s = __kmem_cache_alias(name, object_size, flags, args);
cbb79694d592e9 Christoph Lameter      2012-09-05  375  	if (s)
3965fc36522446 Vladimir Davydov       2014-01-23  376  		goto out_unlock;
cbb79694d592e9 Christoph Lameter      2012-09-05  377  
3dec16ea38afce Andrzej Hajda          2015-02-13  378  	cache_name = kstrdup_const(name, GFP_KERNEL);
794b1248be4e7e Vladimir Davydov       2014-04-07  379  	if (!cache_name) {
3965fc36522446 Vladimir Davydov       2014-01-23  380  		err = -ENOMEM;
3965fc36522446 Vladimir Davydov       2014-01-23  381  		goto out_unlock;
794b1248be4e7e Vladimir Davydov       2014-04-07  382  	}
3965fc36522446 Vladimir Davydov       2014-01-23  383  
34410a906080e7 Christian Brauner      2024-09-05  384  	args->align = calculate_alignment(flags, args->align, object_size);
34410a906080e7 Christian Brauner      2024-09-05  385  	s = create_cache(cache_name, object_size, args, flags);
794b1248be4e7e Vladimir Davydov       2014-04-07  386  	if (IS_ERR(s)) {
794b1248be4e7e Vladimir Davydov       2014-04-07  387  		err = PTR_ERR(s);
3dec16ea38afce Andrzej Hajda          2015-02-13  388  		kfree_const(cache_name);
794b1248be4e7e Vladimir Davydov       2014-04-07  389  	}
db265eca77000c Christoph Lameter      2012-09-04  390  
3965fc36522446 Vladimir Davydov       2014-01-23  391  out_unlock:
20cea9683ecc6d Christoph Lameter      2012-07-06  392  	mutex_unlock(&slab_mutex);
03afc0e25f7fc0 Vladimir Davydov       2014-06-04  393  
ba3253c78d7443 Dave Jones             2014-01-29  394  	if (err) {
686d550d222e8f Christoph Lameter      2012-09-05  395  		if (flags & SLAB_PANIC)
4acaa7d5045e21 gumingtao              2021-06-28  396  			panic("%s: Failed to create slab '%s'. Error %d\n",
4acaa7d5045e21 gumingtao              2021-06-28  397  				__func__, name, err);
686d550d222e8f Christoph Lameter      2012-09-05  398  		else {
4acaa7d5045e21 gumingtao              2021-06-28  399  			pr_warn("%s(%s) failed with error %d\n",
4acaa7d5045e21 gumingtao              2021-06-28  400  				__func__, name, err);
686d550d222e8f Christoph Lameter      2012-09-05  401  			dump_stack();
686d550d222e8f Christoph Lameter      2012-09-05  402  		}
686d550d222e8f Christoph Lameter      2012-09-05  403  		return NULL;
686d550d222e8f Christoph Lameter      2012-09-05  404  	}
039363f38bfe5f Christoph Lameter      2012-07-06  405  	return s;
794b1248be4e7e Vladimir Davydov       2014-04-07  406  }
879fb3c274c12c Christian Brauner      2024-09-05  407  EXPORT_SYMBOL(__kmem_cache_create_args);
3965fc36522446 Vladimir Davydov       2014-01-23  408  

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

                 reply	other threads:[~2026-10-22  9:57 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=202610221102.1ITKXBWg-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.