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


Groups > linux.kernel > #1700658 > unrolled thread

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

Started byStephen Rothwell <sfr@canb.auug.org.au>
First post2017-08-01 08:10 +0200
Last post2017-08-01 23:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  linux-next: build warning after merge of the akpm tree Stephen Rothwell <sfr@canb.auug.org.au> - 2017-08-01 08:10 +0200
    Re: linux-next: build warning after merge of the akpm tree "Huang\, Ying" <ying.huang@intel.com> - 2017-08-01 08:20 +0200
      Re: linux-next: build warning after merge of the akpm tree Arnd Bergmann <arnd@arndb.de> - 2017-08-01 23:20 +0200

#1700658 — linux-next: build warning after merge of the akpm tree

FromStephen Rothwell <sfr@canb.auug.org.au>
Date2017-08-01 08:10 +0200
Subjectlinux-next: build warning after merge of the akpm tree
Message-ID<u9yxs-81g-7@gated-at.bofh.it>
Hi Andrew,

After merging the akpm tree, today's linux-next build (x86_64
allmodconfig) produced this warning:

mm/swapfile.c: In function 'reuse_swap_page':
mm/swapfile.c:1429:16: warning: 'offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
  unsigned long offset;
                ^

Introduced by commit

  e16cd4930836 ("mm, THP, swap: make reuse_swap_page() works for THP swapped out")

-- 
Cheers,
Stephen Rothwell

[toc] | [next] | [standalone]


#1700661

From"Huang\, Ying" <ying.huang@intel.com>
Date2017-08-01 08:20 +0200
Message-ID<u9yH8-84C-5@gated-at.bofh.it>
In reply to#1700658
Hi, Stephen,

Thanks for reporting.

Stephen Rothwell <sfr@canb.auug.org.au> writes:

> Hi Andrew,
>
> After merging the akpm tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
>
> mm/swapfile.c: In function 'reuse_swap_page':
> mm/swapfile.c:1429:16: warning: 'offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   unsigned long offset;
>                 ^
>
> Introduced by commit
>
>   e16cd4930836 ("mm, THP, swap: make reuse_swap_page() works for THP swapped out")

This looks like a false positive reporting and not reported by my
compiler and kbuild compiler (gcc-6).  But anyway, we should silence it.

Best Regards,
Huang, Ying

---------->8----------
From 7a7ff76d7bcbd7affda169b29abcf3dafa38052e Mon Sep 17 00:00:00 2001
From: Huang Ying <ying.huang@intel.com>
Date: Tue, 1 Aug 2017 14:12:21 +0800
Subject: [PATCH] mm, THP, swap: Silence a compiler warning

To fix the following compiler warning,

mm/swapfile.c: In function 'reuse_swap_page':
mm/swapfile.c:1429:16: warning: 'offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
  unsigned long offset;
                ^

This is a false positive report, but we should silence it anyway.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
---
 mm/swapfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 32434541cc12..64a94f70e867 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1426,7 +1426,7 @@ static int page_trans_huge_map_swapcount(struct page *page, int *total_mapcount,
 					 int *total_swapcount)
 {
 	int i, map_swapcount, _total_mapcount, _total_swapcount;
-	unsigned long offset;
+	unsigned long offset = 0;
 	struct swap_info_struct *si;
 	struct swap_cluster_info *ci = NULL;
 	unsigned char *map = NULL;
-- 
2.13.2

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


#1701510

FromArnd Bergmann <arnd@arndb.de>
Date2017-08-01 23:20 +0200
Message-ID<u9MK5-L9-1@gated-at.bofh.it>
In reply to#1700661
On Tue, Aug 1, 2017 at 8:15 AM, Huang, Ying <ying.huang@intel.com> wrote:
> From 7a7ff76d7bcbd7affda169b29abcf3dafa38052e Mon Sep 17 00:00:00 2001
> From: Huang Ying <ying.huang@intel.com>
> Date: Tue, 1 Aug 2017 14:12:21 +0800
> Subject: [PATCH] mm, THP, swap: Silence a compiler warning
>
> To fix the following compiler warning,
>
> mm/swapfile.c: In function 'reuse_swap_page':
> mm/swapfile.c:1429:16: warning: 'offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   unsigned long offset;
>                 ^
>
> This is a false positive report, but we should silence it anyway.

Looks ok, I ran into this too, and came to the same conclusion.
I normally try to find a way to reorganize the code without adding
a bogus initialization, but here I could not find come up with anything
better than what you did.

        Arnd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web