Messages in this thread Patch in this message | | | Date | Wed, 8 May 2024 14:03:34 +0800 | Subject | Re: [PATCH 6/8] mm: shmem: add mTHP support for anonymous shmem | From | Baolin Wang <> |
| |
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;
| |