diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2018-04-05 16:20:26 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-05 21:36:23 -0700 |
commit | 0be70327ec8cf6dd6847cbd8b75ca51be864a6ea (patch) | |
tree | d0e66c101f169a234ce233806d376ed5da400a18 /include | |
parent | 36071a279b4100afe9fbee18727ad78daa307591 (diff) | |
download | linux-0be70327ec8cf6dd6847cbd8b75ca51be864a6ea.tar.bz2 |
slab: make kmalloc_size() return "unsigned int"
kmalloc_size() derives size of kmalloc cache from internal index, which
can't be negative.
Propagate unsignedness a bit.
Link: http://lkml.kernel.org/r/20180305200730.15812-3-adobriyan@gmail.com
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/slab.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 296f33a512eb..ad157fbf3886 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -522,11 +522,11 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) * return size or 0 if a kmalloc cache for that * size does not exist */ -static __always_inline int kmalloc_size(int n) +static __always_inline unsigned int kmalloc_size(unsigned int n) { #ifndef CONFIG_SLOB if (n > 2) - return 1 << n; + return 1U << n; if (n == 1 && KMALLOC_MIN_SIZE <= 32) return 96; |