linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Kent Overstreet <kent.overstreet@linux.dev>,
	Kees Cook <keescook@chromium.org>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: mm/slub.c:3905:29: error: variable 'obj_exts' set but not used
Date: Sat, 15 Jun 2024 05:08:36 +0800	[thread overview]
Message-ID: <202406150444.F6neSaiy-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c286c21ff94252f778515b21b6bebe749454a852
commit: 4b8736964640fe160724e7135dc62883bddcdace mm/slab: add allocation accounting into slab allocation and free paths
date:   7 weeks ago
config: x86_64-sof-customedconfig-atom-defconfig (https://download.01.org/0day-ci/archive/20240615/202406150444.F6neSaiy-lkp@intel.com/config)
compiler: gcc-11 (Ubuntu 11.4.0-4ubuntu1) 11.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240615/202406150444.F6neSaiy-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/oe-kbuild-all/202406150444.F6neSaiy-lkp@intel.com/

All errors (new ones prefixed by >>):

   mm/slub.c: In function 'slab_post_alloc_hook':
>> mm/slub.c:3905:29: error: variable 'obj_exts' set but not used [-Werror=unused-but-set-variable]
    3905 |         struct slabobj_ext *obj_exts;
         |                             ^~~~~~~~
   cc1: all warnings being treated as errors


vim +/obj_exts +3905 mm/slub.c

  3898	
  3899	static __fastpath_inline
  3900	void slab_post_alloc_hook(struct kmem_cache *s,	struct obj_cgroup *objcg,
  3901				  gfp_t flags, size_t size, void **p, bool init,
  3902				  unsigned int orig_size)
  3903	{
  3904		unsigned int zero_size = s->object_size;
> 3905		struct slabobj_ext *obj_exts;
  3906		bool kasan_init = init;
  3907		size_t i;
  3908		gfp_t init_flags = flags & gfp_allowed_mask;
  3909	
  3910		/*
  3911		 * For kmalloc object, the allocated memory size(object_size) is likely
  3912		 * larger than the requested size(orig_size). If redzone check is
  3913		 * enabled for the extra space, don't zero it, as it will be redzoned
  3914		 * soon. The redzone operation for this extra space could be seen as a
  3915		 * replacement of current poisoning under certain debug option, and
  3916		 * won't break other sanity checks.
  3917		 */
  3918		if (kmem_cache_debug_flags(s, SLAB_STORE_USER | SLAB_RED_ZONE) &&
  3919		    (s->flags & SLAB_KMALLOC))
  3920			zero_size = orig_size;
  3921	
  3922		/*
  3923		 * When slab_debug is enabled, avoid memory initialization integrated
  3924		 * into KASAN and instead zero out the memory via the memset below with
  3925		 * the proper size. Otherwise, KASAN might overwrite SLUB redzones and
  3926		 * cause false-positive reports. This does not lead to a performance
  3927		 * penalty on production builds, as slab_debug is not intended to be
  3928		 * enabled there.
  3929		 */
  3930		if (__slub_debug_enabled())
  3931			kasan_init = false;
  3932	
  3933		/*
  3934		 * As memory initialization might be integrated into KASAN,
  3935		 * kasan_slab_alloc and initialization memset must be
  3936		 * kept together to avoid discrepancies in behavior.
  3937		 *
  3938		 * As p[i] might get tagged, memset and kmemleak hook come after KASAN.
  3939		 */
  3940		for (i = 0; i < size; i++) {
  3941			p[i] = kasan_slab_alloc(s, p[i], init_flags, kasan_init);
  3942			if (p[i] && init && (!kasan_init ||
  3943					     !kasan_has_integrated_init()))
  3944				memset(p[i], 0, zero_size);
  3945			kmemleak_alloc_recursive(p[i], s->object_size, 1,
  3946						 s->flags, init_flags);
  3947			kmsan_slab_alloc(s, p[i], init_flags);
  3948			if (need_slab_obj_ext()) {
  3949				obj_exts = prepare_slab_obj_exts_hook(s, flags, p[i]);
  3950	#ifdef CONFIG_MEM_ALLOC_PROFILING
  3951				/*
  3952				 * Currently obj_exts is used only for allocation profiling.
  3953				 * If other users appear then mem_alloc_profiling_enabled()
  3954				 * check should be added before alloc_tag_add().
  3955				 */
  3956				if (likely(obj_exts))
  3957					alloc_tag_add(&obj_exts->ref, current->alloc_tag, s->size);
  3958	#endif
  3959			}
  3960		}
  3961	
  3962		memcg_slab_post_alloc_hook(s, objcg, flags, size, p);
  3963	}
  3964	

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


             reply	other threads:[~2024-06-14 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 21:08 kernel test robot [this message]
2024-06-14 23:05 ` Suren Baghdasaryan

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=202406150444.F6neSaiy-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox