All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Xiubo Li <Li.Xiubo@freescale.com>,
	akpm@linux-foundation.org, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, mgorman@suse.de,
	rientjes@google.com, minchan@kernel.org
Subject: Re: [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly.
Date: Tue, 30 Sep 2014 09:27:23 +0200	[thread overview]
Message-ID: <542A5B5B.7060207@suse.cz> (raw)
In-Reply-To: <1411961425-8045-1-git-send-email-Li.Xiubo@freescale.com>

On 09/29/2014 05:30 AM, Xiubo Li wrote:
> Setting 'flags' to zero will be certainly a misleading way to avoid
> warning of 'flags' may be used uninitialized. uninitialized_var is
> a correct way because the warning is a false possitive.

Agree.

> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/compaction.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 92075d5..59a116d 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -344,7 +344,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
>  {
>  	int nr_scanned = 0, total_isolated = 0;
>  	struct page *cursor, *valid_page = NULL;
> -	unsigned long flags = 0;
> +	unsigned long uninitialized_var(flags);
>  	bool locked = false;
>  	unsigned long blockpfn = *start_pfn;
>  
> @@ -573,7 +573,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  	unsigned long nr_scanned = 0, nr_isolated = 0;
>  	struct list_head *migratelist = &cc->migratepages;
>  	struct lruvec *lruvec;
> -	unsigned long flags = 0;
> +	unsigned long uninitialized_var(flags);
>  	bool locked = false;
>  	struct page *page = NULL, *valid_page = NULL;
>  
> 

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Vlastimil Babka <vbabka@suse.cz>
To: Xiubo Li <Li.Xiubo@freescale.com>,
	akpm@linux-foundation.org, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, mgorman@suse.de,
	rientjes@google.com, minchan@kernel.org
Subject: Re: [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly.
Date: Tue, 30 Sep 2014 09:27:23 +0200	[thread overview]
Message-ID: <542A5B5B.7060207@suse.cz> (raw)
In-Reply-To: <1411961425-8045-1-git-send-email-Li.Xiubo@freescale.com>

On 09/29/2014 05:30 AM, Xiubo Li wrote:
> Setting 'flags' to zero will be certainly a misleading way to avoid
> warning of 'flags' may be used uninitialized. uninitialized_var is
> a correct way because the warning is a false possitive.

Agree.

> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/compaction.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 92075d5..59a116d 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -344,7 +344,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
>  {
>  	int nr_scanned = 0, total_isolated = 0;
>  	struct page *cursor, *valid_page = NULL;
> -	unsigned long flags = 0;
> +	unsigned long uninitialized_var(flags);
>  	bool locked = false;
>  	unsigned long blockpfn = *start_pfn;
>  
> @@ -573,7 +573,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  	unsigned long nr_scanned = 0, nr_isolated = 0;
>  	struct list_head *migratelist = &cc->migratepages;
>  	struct lruvec *lruvec;
> -	unsigned long flags = 0;
> +	unsigned long uninitialized_var(flags);
>  	bool locked = false;
>  	struct page *page = NULL, *valid_page = NULL;
>  
> 


  reply	other threads:[~2014-09-30  7:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29  3:30 [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly Xiubo Li
2014-09-29  3:30 ` Xiubo Li
2014-09-30  7:27 ` Vlastimil Babka [this message]
2014-09-30  7:27   ` Vlastimil Babka
2014-10-01 20:16   ` David Rientjes
2014-10-01 20:16     ` David Rientjes
2014-10-01 21:18     ` Vlastimil Babka
2014-10-01 21:18       ` Vlastimil Babka
2014-10-01 21:25       ` Andrew Morton
2014-10-01 21:25         ` Andrew Morton

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=542A5B5B.7060207@suse.cz \
    --to=vbabka@suse.cz \
    --cc=Li.Xiubo@freescale.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=rientjes@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.