linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Lord Glauber Costa of Sealand <glommer@parallels.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH] memcg: fix typo in kmemcg cache walk macro
Date: Fri, 25 Jan 2013 13:37:10 +0100	[thread overview]
Message-ID: <20130125123710.GE8876@dhcp22.suse.cz> (raw)
In-Reply-To: <1359116275-25298-1-git-send-email-glommer@parallels.com>

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>

      reply	other threads:[~2013-01-25 12:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-25 12:17 Lord Glauber Costa of Sealand
2013-01-25 12:37 ` Michal Hocko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130125123710.GE8876@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=glommer@parallels.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox