Commit 9163582c authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Linus Torvalds
Browse files

slab: fix for_each_kmem_cache_node()

Fix a bug (discovered with kmemcheck) in for_each_kmem_cache_node().  The
for loop reads the array "node" before verifying that the index is within
the range.  This results in kmemcheck warning.

Signed-off-by: default avatarMikulas Patocka <>
Reviewed-by: default avatarPekka Enberg <>
Acked-by: default avatarChristoph Lameter <>
Cc: David Rientjes <>
Cc: Joonsoo Kim <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 10922838
......@@ -338,8 +338,8 @@ static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node)
* a kmem_cache_node structure allocated (which is true for all online nodes)
#define for_each_kmem_cache_node(__s, __node, __n) \
for (__node = 0; __n = get_node(__s, __node), __node < nr_node_ids; __node++) \
if (__n)
for (__node = 0; __node < nr_node_ids; __node++) \
if ((__n = get_node(__s, __node)))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment