summaryrefslogtreecommitdiffstats
path: root/mm/slab.h
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2014-10-09 18:26:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-09 22:25:51 -0400
commit9163582c3f22cfba90a78749751ac70b127a9167 (patch)
treee3300b170d693fae1ae2f35dce016f5ecedb6058 /mm/slab.h
parent109228389a943edd7e5c6ae94a7fda119691baec (diff)
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: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Pekka Enberg <penberg@kernel.org> Acked-by: Christoph Lameter <cl@linux.com> 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 'mm/slab.h')
-rw-r--r--mm/slab.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/slab.h b/mm/slab.h
index 026e7c393f0b..6599f2084e80 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -338,8 +338,8 @@ static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node)
338 * a kmem_cache_node structure allocated (which is true for all online nodes) 338 * a kmem_cache_node structure allocated (which is true for all online nodes)
339 */ 339 */
340#define for_each_kmem_cache_node(__s, __node, __n) \ 340#define for_each_kmem_cache_node(__s, __node, __n) \
341 for (__node = 0; __n = get_node(__s, __node), __node < nr_node_ids; __node++) \ 341 for (__node = 0; __node < nr_node_ids; __node++) \
342 if (__n) 342 if ((__n = get_node(__s, __node)))
343 343
344#endif 344#endif
345 345