[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220509123116.3169267-1-trix@redhat.com>
Date: Mon, 9 May 2022 08:31:16 -0400
From: Tom Rix <trix@...hat.com>
To: hughd@...gle.com, akpm@...ux-foundation.org, nathan@...nel.org,
ndesaulniers@...gle.com, willy@...radead.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, Tom Rix <trix@...hat.com>
Subject: [PATCH] mm/shmem: initialize folio to NULL
The clang build fails with
mm/shmem.c:1704:7: error: variable 'folio' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (!page) {
^~~~~
The error handler for !page jumps to an if-check for an unset folio.
So initialize folio to NULL.
Fixes: 2b58b3f33ba2 ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()")
Signed-off-by: Tom Rix <trix@...hat.com>
---
mm/shmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 107f1e4dd0aa..7faaa61ff7fa 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1682,7 +1682,7 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index,
struct shmem_inode_info *info = SHMEM_I(inode);
struct mm_struct *charge_mm = vma ? vma->vm_mm : NULL;
struct page *page;
- struct folio *folio;
+ struct folio *folio = NULL;
swp_entry_t swap;
int error;
--
2.27.0
Powered by blists - more mailing lists