All of lore.kernel.org
 help / color / mirror / Atom feed
* [android-common:android16-6.12 0/1] mm/slub.c:775:31: sparse: sparse: unsigned value that used to be signed checked against zero?
@ 2026-08-08 14:33 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-08-08 14:33 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check warning: mm/slub.c:775:31: sparse: sparse: unsigned value that used to be signed checked against zero?"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: cros-kernel-buildreports@googlegroups.com

Hi Harry,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree:   https://android.googlesource.com/kernel/common android16-6.12
head:   749a6f9d41aa0bad1b1893ebae8598ca7875d09e
commit: b6e5cef4d6df31f7e61f2e2713b3358a0b48f7e7 [0/1] mm/slab: use unsigned long for orig_size to ensure proper metadata align
:::::: branch date: 2 days ago
:::::: commit date: 5 months ago
config: x86_64-randconfig-122-20260808 (https://download.01.org/0day-ci/archive/20260808/202608082211.XpNvDSlE-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260808/202608082211.XpNvDSlE-lkp@intel.com/reproduce)

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/r/202608082211.XpNvDSlE-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> mm/slub.c:775:31: sparse: sparse: unsigned value that used to be signed checked against zero?
   mm/slub.c:1616:34: sparse: signed value source
   mm/slub.c:3179:55: sparse: sparse: context imbalance in '__put_partials' - unexpected unlock
   mm/slub.c:4475:47: sparse: sparse: context imbalance in '__slab_free' - unexpected unlock

vim +775 mm/slub.c

b789ef518b2a72 Christoph Lameter 2011-06-01  752  
59090e479ac78a Peng Fan          2024-08-29  753  /*
59090e479ac78a Peng Fan          2024-08-29  754   * kmalloc caches has fixed sizes (mostly power of 2), and kmalloc() API
59090e479ac78a Peng Fan          2024-08-29  755   * family will round up the real request size to these fixed ones, so
59090e479ac78a Peng Fan          2024-08-29  756   * there could be an extra area than what is requested. Save the original
59090e479ac78a Peng Fan          2024-08-29  757   * request size in the meta data area, for better debug and sanity check.
59090e479ac78a Peng Fan          2024-08-29  758   */
59090e479ac78a Peng Fan          2024-08-29  759  static inline void set_orig_size(struct kmem_cache *s,
b6e5cef4d6df31 Harry Yoo         2026-01-13  760  				void *object, unsigned long orig_size)
59090e479ac78a Peng Fan          2024-08-29  761  {
59090e479ac78a Peng Fan          2024-08-29  762  	void *p = kasan_reset_tag(object);
59090e479ac78a Peng Fan          2024-08-29  763  	unsigned int kasan_meta_size;
59090e479ac78a Peng Fan          2024-08-29  764  
59090e479ac78a Peng Fan          2024-08-29  765  	if (!slub_debug_orig_size(s))
59090e479ac78a Peng Fan          2024-08-29  766  		return;
59090e479ac78a Peng Fan          2024-08-29  767  
59090e479ac78a Peng Fan          2024-08-29  768  	/*
59090e479ac78a Peng Fan          2024-08-29  769  	 * KASAN can save its free meta data inside of the object at offset 0.
59090e479ac78a Peng Fan          2024-08-29  770  	 * If this meta data size is larger than 'orig_size', it will overlap
59090e479ac78a Peng Fan          2024-08-29  771  	 * the data redzone in [orig_size+1, object_size]. Thus, we adjust
59090e479ac78a Peng Fan          2024-08-29  772  	 * 'orig_size' to be as at least as big as KASAN's meta data.
59090e479ac78a Peng Fan          2024-08-29  773  	 */
59090e479ac78a Peng Fan          2024-08-29  774  	kasan_meta_size = kasan_metadata_size(s, true);
59090e479ac78a Peng Fan          2024-08-29 @775  	if (kasan_meta_size > orig_size)
59090e479ac78a Peng Fan          2024-08-29  776  		orig_size = kasan_meta_size;
59090e479ac78a Peng Fan          2024-08-29  777  
59090e479ac78a Peng Fan          2024-08-29  778  	p += get_info_end(s);
59090e479ac78a Peng Fan          2024-08-29  779  	p += sizeof(struct track) * 2;
59090e479ac78a Peng Fan          2024-08-29  780  
b6e5cef4d6df31 Harry Yoo         2026-01-13  781  	*(unsigned long *)p = orig_size;
59090e479ac78a Peng Fan          2024-08-29  782  }
59090e479ac78a Peng Fan          2024-08-29  783  

:::::: The code at line 775 was first introduced by commit
:::::: 59090e479ac78ae18facd4c58eb332562a23020e mm, slub: avoid zeroing kmalloc redzone

:::::: TO: Peng Fan <peng.fan@nxp.com>
:::::: CC: Vlastimil Babka <vbabka@suse.cz>

--
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-08-08 14:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 14:33 [android-common:android16-6.12 0/1] mm/slub.c:775:31: sparse: sparse: unsigned value that used to be signed checked against zero? 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.