linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [next] x86: fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is uninitialized when used here [-Werror,-Wuninitialized]
@ 2022-08-25 10:43 Naresh Kamboju
  2022-08-25 16:10 ` Nathan Chancellor
  2022-08-25 16:56 ` Mike Kravetz
  0 siblings, 2 replies; 4+ messages in thread
From: Naresh Kamboju @ 2022-08-25 10:43 UTC (permalink / raw)
  To: Mike Kravetz, linux-mm, Andrew Morton, open list, regressions,
	Nathan Chancellor, clang-built-linux
  Cc: Muchun Song, Andrea Arcangeli, Aneesh Kumar K.V, Axel Rasmussen,
	David Hildenbrand, Davidlohr Bueso, James Houghton,
	Kirill A. Shutemov, Miaohe Lin, Michal Hocko, Mina Almasry,
	Naoya Horiguchi, Pasha Tatashin, Peter Xu, Prakash Sangappa

The x86_64 and i386 clang builds failed due to these warnings / errors
on Linux next-20220825.

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is
uninitialized when used here [-Werror,-Wuninitialized]
                                                m_start, m_index, truncate_op);
                                                         ^~~~~~~
fs/hugetlbfs/inode.c:651:26: note: initialize the variable 'm_index'
to silence this warning
        pgoff_t m_start, m_index;
                                ^
                                 = 0
1 error generated.
make[3]: *** [scripts/Makefile.build:250: fs/hugetlbfs/inode.o] Error 1
make[3]: Target '__build' not remade because of errors.
make[2]: *** [scripts/Makefile.build:525: fs/hugetlbfs] Error 2

Build link: https://builds.tuxbuild.com/2Dpvef6uVvzHMztbfQRmxJfPXZT/

Steps to reproduce:
-------------------
# To install tuxmake on your system globally:
# sudo pip3 install -U tuxmake

tuxmake --runtime podman --target-arch x86_64 --toolchain clang-14
--kconfig https://builds.tuxbuild.com/2Dpvef6uVvzHMztbfQRmxJfPXZT/config
LLVM=1 LLVM_IAS=1

--
Linaro LKFT
https://lkft.linaro.org


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

* Re: [next] x86: fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is uninitialized when used here [-Werror,-Wuninitialized]
  2022-08-25 10:43 [next] x86: fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is uninitialized when used here [-Werror,-Wuninitialized] Naresh Kamboju
@ 2022-08-25 16:10 ` Nathan Chancellor
  2022-08-25 16:56 ` Mike Kravetz
  1 sibling, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2022-08-25 16:10 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: Mike Kravetz, linux-mm, Andrew Morton, open list, regressions,
	clang-built-linux, Muchun Song, Andrea Arcangeli,
	Aneesh Kumar K.V, Axel Rasmussen, David Hildenbrand,
	Davidlohr Bueso, James Houghton, Kirill A. Shutemov, Miaohe Lin,
	Michal Hocko, Mina Almasry, Naoya Horiguchi, Pasha Tatashin,
	Peter Xu, Prakash Sangappa, llvm

Hi Naresh,

On Thu, Aug 25, 2022 at 04:13:30PM +0530, Naresh Kamboju wrote:
> The x86_64 and i386 clang builds failed due to these warnings / errors
> on Linux next-20220825.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> 
> fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is
> uninitialized when used here [-Werror,-Wuninitialized]
>                                                 m_start, m_index, truncate_op);
>                                                          ^~~~~~~
> fs/hugetlbfs/inode.c:651:26: note: initialize the variable 'm_index'
> to silence this warning
>         pgoff_t m_start, m_index;
>                                 ^
>                                  = 0
> 1 error generated.

Thank you for the report! Commit fcc0d3d00d74 ("hugetlb: handle truncate
racing with page faults") introduced this warning; the Intel folks
caught this as well:

https://lore.kernel.org/202208251012.g1mOhhxy-lkp@intel.com/

As an aside, can you please update your contact for our mailing list to
llvm@lists.linux.dev? We do not use the Google Groups list anymore.

Cheers,
Nathan


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

* Re: [next] x86: fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is uninitialized when used here [-Werror,-Wuninitialized]
  2022-08-25 10:43 [next] x86: fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is uninitialized when used here [-Werror,-Wuninitialized] Naresh Kamboju
  2022-08-25 16:10 ` Nathan Chancellor
@ 2022-08-25 16:56 ` Mike Kravetz
  2022-08-26  1:21   ` Andrew Morton
  1 sibling, 1 reply; 4+ messages in thread
From: Mike Kravetz @ 2022-08-25 16:56 UTC (permalink / raw)
  To: Naresh Kamboju, Andrew Morton
  Cc: linux-mm, open list, regressions, Nathan Chancellor,
	clang-built-linux, Muchun Song, Andrea Arcangeli,
	Aneesh Kumar K.V, Axel Rasmussen, David Hildenbrand,
	Davidlohr Bueso, James Houghton, Kirill A. Shutemov, Miaohe Lin,
	Michal Hocko, Mina Almasry, Naoya Horiguchi, Pasha Tatashin,
	Peter Xu, Prakash Sangappa

On 08/25/22 16:13, Naresh Kamboju wrote:
> The x86_64 and i386 clang builds failed due to these warnings / errors
> on Linux next-20220825.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> 
> fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is
> uninitialized when used here [-Werror,-Wuninitialized]
>                                                 m_start, m_index, truncate_op);
>                                                          ^~~~~~~
> fs/hugetlbfs/inode.c:651:26: note: initialize the variable 'm_index'

Thanks!  That really should be 'index' and not 'm_index'.  The variable
m_index was used in a previous version of the code and should have been
deleted.  Depending on the uninitialized value of m_index, this could
cause long delays as the called routine checks the range m_start to m_index.

Andrew, how would you like to address in your tree?  The following patch
can be applied on top of the original (next commit fcc0d3d00d74 "hugetlb:
handle truncate racing with page faults").  Or, I could squash and
resend the original, or resend the entire series.


From 99aae359c3a744e6718045d2f24b55c84bed4d56 Mon Sep 17 00:00:00 2001
From: Mike Kravetz <mike.kravetz@oracle.com>
Date: Thu, 25 Aug 2022 09:49:08 -0700
Subject: [PATCH] hugetlb: fix/remove uninitialized variable in
 remove_inode_hugepages

Code introduced for the routine remove_inode_hugepages by patch "hugetlb:
handle truncate racing with page faults", incorrectly uses a variable
m_index.  This is a remnant from a previous version of the code when
under development.  Use the correct variable 'index' and remove
'm_index' from the routine.

Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
---
 fs/hugetlbfs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 52d9b390389b..2f1d6da1bafb 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -648,7 +648,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
 	const pgoff_t start = lstart >> huge_page_shift(h);
 	const pgoff_t end = lend >> huge_page_shift(h);
 	pgoff_t m_end = lm_end >> huge_page_shift(h);
-	pgoff_t m_start, m_index;
+	pgoff_t m_start;
 	struct folio_batch fbatch;
 	struct folio *folio;
 	pgoff_t next, index;
@@ -670,7 +670,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
 			 * due to a race with fault code.
 			 */
 			freed += fault_lock_inode_indicies(h, inode, mapping,
-						m_start, m_index, truncate_op);
+						m_start, index, truncate_op);
 
 			/*
 			 * Remove folio that was part of folio_batch.
-- 
2.37.1



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

* Re: [next] x86: fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is uninitialized when used here [-Werror,-Wuninitialized]
  2022-08-25 16:56 ` Mike Kravetz
@ 2022-08-26  1:21   ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2022-08-26  1:21 UTC (permalink / raw)
  To: Mike Kravetz
  Cc: Naresh Kamboju, linux-mm, open list, regressions,
	Nathan Chancellor, clang-built-linux, Muchun Song,
	Andrea Arcangeli, Aneesh Kumar K.V, Axel Rasmussen,
	David Hildenbrand, Davidlohr Bueso, James Houghton,
	Kirill A. Shutemov, Miaohe Lin, Michal Hocko, Mina Almasry,
	Naoya Horiguchi, Pasha Tatashin, Peter Xu, Prakash Sangappa

On Thu, 25 Aug 2022 09:56:15 -0700 Mike Kravetz <mike.kravetz@oracle.com> wrote:

> Andrew, how would you like to address in your tree?  The following patch
> can be applied on top of the original (next commit fcc0d3d00d74 "hugetlb:
> handle truncate racing with page faults").  Or, I could squash and
> resend the original, or resend the entire series.

This little fixlet is great, thanks.


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

end of thread, other threads:[~2022-08-26  1:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 10:43 [next] x86: fs/hugetlbfs/inode.c:673:16: error: variable 'm_index' is uninitialized when used here [-Werror,-Wuninitialized] Naresh Kamboju
2022-08-25 16:10 ` Nathan Chancellor
2022-08-25 16:56 ` Mike Kravetz
2022-08-26  1:21   ` 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).