]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
slab: use 32-bit arithmetic in freelist_randomize()
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 5 Apr 2018 23:21:46 +0000 (16:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Apr 2018 04:36:24 +0000 (21:36 -0700)
SLAB doesn't support 4GB+ of objects per slab, therefore randomization
doesn't need size_t.

Link: http://lkml.kernel.org/r/20180305200730.15812-25-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>
mm/slab_common.c

index 01224cb900808010f1301086bbec9fe5b9736f89..e2e2485b3496464f306c16a9e8970218abfe57f7 100644 (file)
@@ -1186,10 +1186,10 @@ EXPORT_SYMBOL(kmalloc_order_trace);
 #ifdef CONFIG_SLAB_FREELIST_RANDOM
 /* Randomize a generic freelist */
 static void freelist_randomize(struct rnd_state *state, unsigned int *list,
-                       size_t count)
+                              unsigned int count)
 {
-       size_t i;
        unsigned int rand;
+       unsigned int i;
 
        for (i = 0; i < count; i++)
                list[i] = i;