[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a6c6c90-04bd-4a02-9080-0f98e8cf5ebe@linux.alibaba.com>
Date: Wed, 8 May 2024 14:03:34 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: kernel test robot <lkp@...el.com>, akpm@...ux-foundation.org,
hughd@...gle.com
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev, willy@...radead.org,
david@...hat.com, ioworker0@...il.com, wangkefeng.wang@...wei.com,
ying.huang@...el.com, 21cnbao@...il.com, ryan.roberts@....com,
shy828301@...il.com, ziy@...dia.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/8] mm: shmem: add mTHP support for anonymous shmem
Hi,
On 2024/5/7 18:46, kernel test robot wrote:
>>> mm/shmem.c:1780:10: warning: variable 'folio' is used uninitialized whenever 'while' loop exits because its condition is false [-Wsometimes-uninitialized]
> 1780 | while (suitable_orders) {
> | ^~~~~~~~~~~~~~~
> mm/shmem.c:1795:7: note: uninitialized use occurs here
> 1795 | if (!folio)
> | ^~~~~
> mm/shmem.c:1780:10: note: remove the condition if it is always true
> 1780 | while (suitable_orders) {
> | ^~~~~~~~~~~~~~~
> | 1
> mm/shmem.c:1750:21: note: initialize the variable 'folio' to silence this warning
> 1750 | struct folio *folio;
> | ^
> | = NULL
> mm/shmem.c:1564:20: warning: unused function 'shmem_show_mpol' [-Wunused-function]
> 1564 | static inline void shmem_show_mpol(struct seq_file *seq, struct mempolicy *mpol)
Thanks for reporting. Will add below change to avoid the warning:
diff --git a/mm/shmem.c b/mm/shmem.c
index d603e36e0f4f..fd2cb2e73a21 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1747,7 +1747,7 @@ static struct folio
*shmem_alloc_and_add_folio(struct vm_fault *vmf,
struct shmem_inode_info *info = SHMEM_I(inode);
struct vm_area_struct *vma = vmf ? vmf->vma : NULL;
unsigned long suitable_orders;
- struct folio *folio;
+ struct folio *folio = NULL;
long pages;
int error, order;
Powered by blists - more mailing lists