Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1610292 > unrolled thread

linux-next: build warning after merge of the md tree

Started byStephen Rothwell <sfr@canb.auug.org.au>
First post2017-03-28 06:50 +0200
Last post2017-03-28 18:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  linux-next: build warning after merge of the md tree Stephen Rothwell <sfr@canb.auug.org.au> - 2017-03-28 06:50 +0200
    Re: linux-next: build warning after merge of the md tree Ming Lei <tom.leiming@gmail.com> - 2017-03-28 10:20 +0200
      Re: linux-next: build warning after merge of the md tree Shaohua Li <shli@kernel.org> - 2017-03-28 18:00 +0200

#1610292 — linux-next: build warning after merge of the md tree

FromStephen Rothwell <sfr@canb.auug.org.au>
Date2017-03-28 06:50 +0200
Subjectlinux-next: build warning after merge of the md tree
Message-ID<tpReV-2lO-3@gated-at.bofh.it>
Hi Shaohua,

After merging the md tree, today's linux-next build (powerpc
pseries_le_defconfig) produced this warning:

drivers/md/raid1.c: In function 'raid1d':
drivers/md/raid1.c:2172:9: warning: 'page_len$' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (memcmp(page_address(ppages[j]),
         ^
drivers/md/raid1.c:2160:7: note: 'page_len$' was declared here
   int page_len[RESYNC_PAGES];
       ^

Introduced by commit

  60928a91b0b3 ("md: raid1: use bio helper in process_checks()")

-- 
Cheers,
Stephen Rothwell

[toc] | [next] | [standalone]


#1610400

FromMing Lei <tom.leiming@gmail.com>
Date2017-03-28 10:20 +0200
Message-ID<tpUwa-4KI-19@gated-at.bofh.it>
In reply to#1610292
Hi,

On Tue, Mar 28, 2017 at 03:40:22PM +1100, Stephen Rothwell wrote:
> Hi Shaohua,
> 
> After merging the md tree, today's linux-next build (powerpc
> pseries_le_defconfig) produced this warning:
> 
> drivers/md/raid1.c: In function 'raid1d':
> drivers/md/raid1.c:2172:9: warning: 'page_len$' may be used uninitialized in this function [-Wmaybe-uninitialized]
>      if (memcmp(page_address(ppages[j]),
>          ^
> drivers/md/raid1.c:2160:7: note: 'page_len$' was declared here
>    int page_len[RESYNC_PAGES];
>        ^
> 
> Introduced by commit
> 
>   60928a91b0b3 ("md: raid1: use bio helper in process_checks()")

It is a false positive, and looks we have to initialize it for killing
the warning since I don't find a annotation for addressing uninitialized
array.

So how about the following patch?

---

From 73fd5ba571465d764fc0cf73fc4169d222dd676a Mon Sep 17 00:00:00 2001
From: Ming Lei <tom.leiming@gmail.com>
Date: Tue, 28 Mar 2017 16:09:13 +0800
Subject: [PATCH] md: raid1: kill warning on powerpc_pseries

This patch kills the warning reported on powerpc_pseries,
and actually we don't need the initialization.

	After merging the md tree, today's linux-next build (powerpc
	pseries_le_defconfig) produced this warning:

	drivers/md/raid1.c: In function 'raid1d':
	drivers/md/raid1.c:2172:9: warning: 'page_len$' may be used uninitialized in this function [-Wmaybe-uninitialized]
	     if (memcmp(page_address(ppages[j]),
	         ^
	drivers/md/raid1.c:2160:7: note: 'page_len$' was declared here
	   int page_len[RESYNC_PAGES];
       ^

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/md/raid1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 3c13286190c1..7e6350334d8e 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2172,7 +2172,7 @@ static void process_checks(struct r1bio *r1_bio)
 		struct page **ppages = get_resync_pages(pbio)->pages;
 		struct page **spages = get_resync_pages(sbio)->pages;
 		struct bio_vec *bi;
-		int page_len[RESYNC_PAGES];
+		int page_len[RESYNC_PAGES] = { 0 };
 
 		if (sbio->bi_end_io != end_sync_read)
 			continue;
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1611131

FromShaohua Li <shli@kernel.org>
Date2017-03-28 18:00 +0200
Message-ID<tq1Hj-1nl-5@gated-at.bofh.it>
In reply to#1610400
On Tue, Mar 28, 2017 at 04:17:55PM +0800, Ming Lei wrote:
> Hi,
> 
> On Tue, Mar 28, 2017 at 03:40:22PM +1100, Stephen Rothwell wrote:
> > Hi Shaohua,
> > 
> > After merging the md tree, today's linux-next build (powerpc
> > pseries_le_defconfig) produced this warning:
> > 
> > drivers/md/raid1.c: In function 'raid1d':
> > drivers/md/raid1.c:2172:9: warning: 'page_len$' may be used uninitialized in this function [-Wmaybe-uninitialized]
> >      if (memcmp(page_address(ppages[j]),
> >          ^
> > drivers/md/raid1.c:2160:7: note: 'page_len$' was declared here
> >    int page_len[RESYNC_PAGES];
> >        ^
> > 
> > Introduced by commit
> > 
> >   60928a91b0b3 ("md: raid1: use bio helper in process_checks()")
> 
> It is a false positive, and looks we have to initialize it for killing
> the warning since I don't find a annotation for addressing uninitialized
> array.
> 
> So how about the following patch?

thanks, added.
 
> ---
> 
> From 73fd5ba571465d764fc0cf73fc4169d222dd676a Mon Sep 17 00:00:00 2001
> From: Ming Lei <tom.leiming@gmail.com>
> Date: Tue, 28 Mar 2017 16:09:13 +0800
> Subject: [PATCH] md: raid1: kill warning on powerpc_pseries
> 
> This patch kills the warning reported on powerpc_pseries,
> and actually we don't need the initialization.
> 
> 	After merging the md tree, today's linux-next build (powerpc
> 	pseries_le_defconfig) produced this warning:
> 
> 	drivers/md/raid1.c: In function 'raid1d':
> 	drivers/md/raid1.c:2172:9: warning: 'page_len$' may be used uninitialized in this function [-Wmaybe-uninitialized]
> 	     if (memcmp(page_address(ppages[j]),
> 	         ^
> 	drivers/md/raid1.c:2160:7: note: 'page_len$' was declared here
> 	   int page_len[RESYNC_PAGES];
>        ^
> 
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> ---
>  drivers/md/raid1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 3c13286190c1..7e6350334d8e 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -2172,7 +2172,7 @@ static void process_checks(struct r1bio *r1_bio)
>  		struct page **ppages = get_resync_pages(pbio)->pages;
>  		struct page **spages = get_resync_pages(sbio)->pages;
>  		struct bio_vec *bi;
> -		int page_len[RESYNC_PAGES];
> +		int page_len[RESYNC_PAGES] = { 0 };
>  
>  		if (sbio->bi_end_io != end_sync_read)
>  			continue;
> -- 
> 2.9.3
> 
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web