linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly.
@ 2014-09-29  3:30 Xiubo Li
  2014-09-30  7:27 ` Vlastimil Babka
  0 siblings, 1 reply; 5+ messages in thread
From: Xiubo Li @ 2014-09-29  3:30 UTC (permalink / raw)
  To: akpm, linux-mm; +Cc: linux-kernel, vbabka, mgorman, rientjes, minchan, Xiubo Li

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.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 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;
 
-- 
2.1.0.27.g96db324

--
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 related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly.
  2014-09-29  3:30 [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly Xiubo Li
@ 2014-09-30  7:27 ` Vlastimil Babka
  2014-10-01 20:16   ` David Rientjes
  0 siblings, 1 reply; 5+ messages in thread
From: Vlastimil Babka @ 2014-09-30  7:27 UTC (permalink / raw)
  To: Xiubo Li, akpm, linux-mm; +Cc: linux-kernel, mgorman, rientjes, minchan

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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly.
  2014-09-30  7:27 ` Vlastimil Babka
@ 2014-10-01 20:16   ` David Rientjes
  2014-10-01 21:18     ` Vlastimil Babka
  0 siblings, 1 reply; 5+ messages in thread
From: David Rientjes @ 2014-10-01 20:16 UTC (permalink / raw)
  To: Vlastimil Babka; +Cc: Xiubo Li, akpm, linux-mm, linux-kernel, mgorman, minchan

On Tue, 30 Sep 2014, Vlastimil Babka wrote:

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

I thought we just discussed this when 
mm-compaction-fix-warning-of-flags-may-be-used-uninitialized.patch was 
merged and, although I liked it, it was stated that we shouldn't add any 
new users of uninitialized_var().

--
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] 5+ messages in thread

* Re: [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly.
  2014-10-01 20:16   ` David Rientjes
@ 2014-10-01 21:18     ` Vlastimil Babka
  2014-10-01 21:25       ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Vlastimil Babka @ 2014-10-01 21:18 UTC (permalink / raw)
  To: David Rientjes
  Cc: Xiubo Li, akpm, linux-mm, linux-kernel, mgorman, minchan,
	Arnd Bergmann

On 10/01/2014 10:16 PM, David Rientjes wrote:
>> 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>
>> 
> 
> I thought we just discussed this when 
> mm-compaction-fix-warning-of-flags-may-be-used-uninitialized.patch was 
> merged and, although I liked it, it was stated that we shouldn't add any 
> new users of uninitialized_var().

Yeah but that discussion wasn't unfortunately CC'd on mailing lists. And my
interpretation of the outcome is that maybe we should try :)

Also note that Arnd sent this kind of fix first, but that thread missed mailing
lists as well. CCing him at least.

Vlastimil

--
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] 5+ messages in thread

* Re: [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly.
  2014-10-01 21:18     ` Vlastimil Babka
@ 2014-10-01 21:25       ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2014-10-01 21:25 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: David Rientjes, Xiubo Li, linux-mm, linux-kernel, mgorman,
	minchan, Arnd Bergmann

On Wed, 01 Oct 2014 23:18:42 +0200 Vlastimil Babka <vbabka@suse.cz> wrote:

> On 10/01/2014 10:16 PM, David Rientjes wrote:
> >> 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>
> >> 
> > 
> > I thought we just discussed this when 
> > mm-compaction-fix-warning-of-flags-may-be-used-uninitialized.patch was 
> > merged and, although I liked it, it was stated that we shouldn't add any 
> > new users of uninitialized_var().
> 
> Yeah but that discussion wasn't unfortunately CC'd on mailing lists. And my
> interpretation of the outcome is that maybe we should try :)
> 

https://lkml.org/lkml/2012/10/27/71

I disagree, can't be bothered getting into a fight over it.  I do tend
to accidentally let new uses sneak into the tree, but this one is a bit
obvious.

--
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] 5+ messages in thread

end of thread, other threads:[~2014-10-01 21:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-29  3:30 [PATCH] mm, compaction: using uninitialized_var insteads setting 'flags' to 0 directly Xiubo Li
2014-09-30  7:27 ` Vlastimil Babka
2014-10-01 20:16   ` David Rientjes
2014-10-01 21:18     ` Vlastimil Babka
2014-10-01 21:25       ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).