linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: kbuild-all@01.org, akpm@linux-foundation.org, linux-mm@kvack.org,
	cl@linux.com, penberg@kernel.org, rientjes@google.com,
	iamjoonsoo.kim@lge.com
Subject: Re: [PATCH 19/23] kasan: make kasan_cache_create() work with 32-bit slab caches
Date: Sat, 25 Nov 2017 06:29:31 +0800	[thread overview]
Message-ID: <201711250632.5AaCH19c%fengguang.wu@intel.com> (raw)
In-Reply-To: <20171123221628.8313-19-adobriyan@gmail.com>

Hi Alexey,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[cannot apply to mmotm/master v4.14 next-20171124]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/slab-make-kmalloc_index-return-unsigned-int/20171125-035138
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)


vim +361 mm/kasan/kasan.c

7ed2f9e6 Alexander Potapenko 2016-03-25  338  
5d094e12 Alexey Dobriyan     2017-11-24  339  void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
d50112ed Alexey Dobriyan     2017-11-15  340  			slab_flags_t *flags)
7ed2f9e6 Alexander Potapenko 2016-03-25  341  {
5d094e12 Alexey Dobriyan     2017-11-24  342  	unsigned int orig_size = *size;
7ed2f9e6 Alexander Potapenko 2016-03-25  343  	int redzone_adjust;
80a9201a Alexander Potapenko 2016-07-28  344  
7ed2f9e6 Alexander Potapenko 2016-03-25  345  	/* Add alloc meta. */
7ed2f9e6 Alexander Potapenko 2016-03-25  346  	cache->kasan_info.alloc_meta_offset = *size;
7ed2f9e6 Alexander Potapenko 2016-03-25  347  	*size += sizeof(struct kasan_alloc_meta);
7ed2f9e6 Alexander Potapenko 2016-03-25  348  
7ed2f9e6 Alexander Potapenko 2016-03-25  349  	/* Add free meta. */
5f0d5a3a Paul E. McKenney    2017-01-18  350  	if (cache->flags & SLAB_TYPESAFE_BY_RCU || cache->ctor ||
7ed2f9e6 Alexander Potapenko 2016-03-25  351  	    cache->object_size < sizeof(struct kasan_free_meta)) {
7ed2f9e6 Alexander Potapenko 2016-03-25  352  		cache->kasan_info.free_meta_offset = *size;
7ed2f9e6 Alexander Potapenko 2016-03-25  353  		*size += sizeof(struct kasan_free_meta);
7ed2f9e6 Alexander Potapenko 2016-03-25  354  	}
7ed2f9e6 Alexander Potapenko 2016-03-25  355  	redzone_adjust = optimal_redzone(cache->object_size) -
7ed2f9e6 Alexander Potapenko 2016-03-25  356  		(*size - cache->object_size);
80a9201a Alexander Potapenko 2016-07-28  357  
7ed2f9e6 Alexander Potapenko 2016-03-25  358  	if (redzone_adjust > 0)
7ed2f9e6 Alexander Potapenko 2016-03-25  359  		*size += redzone_adjust;
80a9201a Alexander Potapenko 2016-07-28  360  
80a9201a Alexander Potapenko 2016-07-28 @361  	*size = min(KMALLOC_MAX_SIZE, max(*size, cache->object_size +
7ed2f9e6 Alexander Potapenko 2016-03-25  362  					optimal_redzone(cache->object_size)));
80a9201a Alexander Potapenko 2016-07-28  363  
80a9201a Alexander Potapenko 2016-07-28  364  	/*
80a9201a Alexander Potapenko 2016-07-28  365  	 * If the metadata doesn't fit, don't enable KASAN at all.
80a9201a Alexander Potapenko 2016-07-28  366  	 */
80a9201a Alexander Potapenko 2016-07-28  367  	if (*size <= cache->kasan_info.alloc_meta_offset ||
80a9201a Alexander Potapenko 2016-07-28  368  			*size <= cache->kasan_info.free_meta_offset) {
80a9201a Alexander Potapenko 2016-07-28  369  		cache->kasan_info.alloc_meta_offset = 0;
80a9201a Alexander Potapenko 2016-07-28  370  		cache->kasan_info.free_meta_offset = 0;
80a9201a Alexander Potapenko 2016-07-28  371  		*size = orig_size;
80a9201a Alexander Potapenko 2016-07-28  372  		return;
80a9201a Alexander Potapenko 2016-07-28  373  	}
80a9201a Alexander Potapenko 2016-07-28  374  
80a9201a Alexander Potapenko 2016-07-28  375  	*flags |= SLAB_KASAN;
7ed2f9e6 Alexander Potapenko 2016-03-25  376  }
7ed2f9e6 Alexander Potapenko 2016-03-25  377  

:::::: The code at line 361 was first introduced by commit
:::::: 80a9201a5965f4715d5c09790862e0df84ce0614 mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

:::::: TO: Alexander Potapenko <glider@google.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-11-24 22:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 22:16 [PATCH 01/23] slab: make kmalloc_index() return "unsigned int" Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 02/23] slab: make kmalloc_size() " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 03/23] slab: create_kmalloc_cache() works with 32-bit sizes Alexey Dobriyan
2017-11-24  1:06   ` Matthew Wilcox
2017-11-27 10:21     ` Alexey Dobriyan
2017-11-27 13:56       ` Matthew Wilcox
2017-11-23 22:16 ` [PATCH 04/23] slab: create_boot_cache() only " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 05/23] slab: kmem_cache_create() " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 06/23] slab: make size_index[] array u8 Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 07/23] slab: make size_index_elem() unsigned int Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 08/23] slub: make ->remote_node_defrag_ratio " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 09/23] slub: make ->max_attr_size " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 10/23] slub: make ->red_left_pad " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 11/23] slub: make ->reserved " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 12/23] slub: make ->align " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 13/23] slub: make ->inuse " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 14/23] slub: make ->cpu_partial " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 15/23] slub: make ->offset " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 16/23] slub: make ->object_size " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 17/23] slub: make ->size " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 18/23] slab: make kmem_cache_flags accept 32-bit object size Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 19/23] kasan: make kasan_cache_create() work with 32-bit slab caches Alexey Dobriyan
2017-11-24 22:29   ` kbuild test robot [this message]
2017-11-23 22:16 ` [PATCH 20/23] slub: make slab_index() return unsigned int Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 21/23] slub: make struct kmem_cache_order_objects::x " Alexey Dobriyan
2017-11-24 17:31   ` Christopher Lameter
2017-11-27 10:17     ` Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 22/23] slub: make size_from_object() return " Alexey Dobriyan
2017-11-23 22:16 ` [PATCH 23/23] slab: use 32-bit arithmetic in freelist_randomize() Alexey Dobriyan
2017-11-28  0:36 ` [PATCH 01/23] slab: make kmalloc_index() return "unsigned int" Andrew Morton
2017-11-28 18:46   ` Christopher Lameter

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=201711250632.5AaCH19c%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kbuild-all@01.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /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