slub: make ->reserved unsigned int
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 5 Apr 2018 23:20:58 +0000 (16:20 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Apr 2018 04:36:23 +0000 (21:36 -0700)
->reserved is either 0 or sizeof(struct rcu_head), can't be negative.

Link: http://lkml.kernel.org/r/20180305200730.15812-12-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>
include/linux/slub_def.h
mm/slub.c

index 9f59fc1..2b4417a 100644 (file)
@@ -100,7 +100,7 @@ struct kmem_cache {
        void (*ctor)(void *);
        int inuse;              /* Offset to metadata */
        int align;              /* Alignment */
-       int reserved;           /* Reserved bytes at the end of slabs */
+       unsigned int reserved;          /* Reserved bytes at the end of slabs */
        unsigned int red_left_pad;      /* Left redzone padding size */
        const char *name;       /* Name (only for display!) */
        struct list_head list;  /* List of slab caches */
index 97dd2db..e38221c 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5094,7 +5094,7 @@ SLAB_ATTR_RO(destroy_by_rcu);
 
 static ssize_t reserved_show(struct kmem_cache *s, char *buf)
 {
-       return sprintf(buf, "%d\n", s->reserved);
+       return sprintf(buf, "%u\n", s->reserved);
 }
 SLAB_ATTR_RO(reserved);