* [PATCH] memcg: fix typo in kmemcg cache walk macro
@ 2013-01-25 12:17 Lord Glauber Costa of Sealand
2013-01-25 12:37 ` Michal Hocko
0 siblings, 1 reply; 2+ messages in thread
From: Lord Glauber Costa of Sealand @ 2013-01-25 12:17 UTC (permalink / raw)
To: linux-mm
Cc: Andrew Morton, Glauber Costa, Michal Hocko, Kamezawa Hiroyuki,
Johannes Weiner
From: Glauber Costa <glommer@parallels.com>
The macro for_each_memcg_cache_index contains a silly yet potentially
deadly mistake. Although the macro parameter is _idx, the loop tests are
done over i, not _idx.
This hasn't generated any problems so far, because all users use i as a
loop index. However, while playing with an extension of the code I
ended using another loop index and the compiler was quick to complain.
Unfortunately, this is not the kind of thing that testing reveals =(
Signed-off-by: Glauber Costa <glommer@parallels.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
---
include/linux/memcontrol.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 904084f..2a876a3 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -424,7 +424,7 @@ extern int memcg_limited_groups_array_size;
* the slab_mutex must be held when looping through those caches
*/
#define for_each_memcg_cache_index(_idx) \
- for ((_idx) = 0; i < memcg_limited_groups_array_size; (_idx)++)
+ for ((_idx) = 0; (_idx) < memcg_limited_groups_array_size; (_idx)++)
static inline bool memcg_kmem_enabled(void)
{
--
1.8.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] memcg: fix typo in kmemcg cache walk macro
2013-01-25 12:17 [PATCH] memcg: fix typo in kmemcg cache walk macro Lord Glauber Costa of Sealand
@ 2013-01-25 12:37 ` Michal Hocko
0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2013-01-25 12:37 UTC (permalink / raw)
To: Lord Glauber Costa of Sealand
Cc: linux-mm, Andrew Morton, Kamezawa Hiroyuki, Johannes Weiner
On Fri 25-01-13 16:17:55, Glauber Costa wrote:
> From: Glauber Costa <glommer@parallels.com>
>
> The macro for_each_memcg_cache_index contains a silly yet potentially
> deadly mistake. Although the macro parameter is _idx, the loop tests are
> done over i, not _idx.
>
> This hasn't generated any problems so far, because all users use i as a
> loop index. However, while playing with an extension of the code I
> ended using another loop index and the compiler was quick to complain.
>
> Unfortunately, this is not the kind of thing that testing reveals =(
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
Ouch.
Acked-by: Michal Hocko <mhocko@suse.cz>
> ---
> include/linux/memcontrol.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 904084f..2a876a3 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -424,7 +424,7 @@ extern int memcg_limited_groups_array_size;
> * the slab_mutex must be held when looping through those caches
> */
> #define for_each_memcg_cache_index(_idx) \
> - for ((_idx) = 0; i < memcg_limited_groups_array_size; (_idx)++)
> + for ((_idx) = 0; (_idx) < memcg_limited_groups_array_size; (_idx)++)
>
> static inline bool memcg_kmem_enabled(void)
> {
> --
> 1.8.1
>
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-25 12:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-25 12:17 [PATCH] memcg: fix typo in kmemcg cache walk macro Lord Glauber Costa of Sealand
2013-01-25 12:37 ` Michal Hocko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox