linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/shmem: restore setting of page variable
@ 2022-05-09 12:32 Tom Rix
  2022-05-09 18:03 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Rix @ 2022-05-09 12:32 UTC (permalink / raw)
  To: hughd, akpm, nathan, ndesaulniers, willy
  Cc: linux-mm, linux-kernel, llvm, Tom Rix

The clang build fails with
mm/shmem.c:2337:8: error: variable 'page' is uninitialized when used here [-Werror,-Wuninitialized]
  if (!page)
       ^~~~

In the commit listed in the fixes, there was a change to the
from
  page = shmem_alloc_page(..);
to
  page = &shmem_alloc_folio(..)->page;
But in this case, instead of replacing, the setting of page was
deleted.  So restore page with its new api.

Fixes: b0bb08b2d5f3 ("mm/shmem: turn shmem_alloc_page() into shmem_alloc_folio()")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 mm/shmem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/shmem.c b/mm/shmem.c
index 7faaa61ff7fa..a2234f19b711 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2334,6 +2334,7 @@ int shmem_mfill_atomic_pte(struct mm_struct *dst_mm,
 
 	if (!*pagep) {
 		ret = -ENOMEM;
+		page = &shmem_alloc_folio(gfp, info, pgoff)->page;
 		if (!page)
 			goto out_unacct_blocks;
 
-- 
2.27.0


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

* Re: [PATCH] mm/shmem: restore setting of page variable
  2022-05-09 12:32 [PATCH] mm/shmem: restore setting of page variable Tom Rix
@ 2022-05-09 18:03 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2022-05-09 18:03 UTC (permalink / raw)
  To: Tom Rix; +Cc: hughd, nathan, ndesaulniers, willy, linux-mm, linux-kernel, llvm

On Mon,  9 May 2022 08:32:32 -0400 Tom Rix <trix@redhat.com> wrote:

> The clang build fails with
> mm/shmem.c:2337:8: error: variable 'page' is uninitialized when used here [-Werror,-Wuninitialized]
>   if (!page)
>        ^~~~
> 
> In the commit listed in the fixes, there was a change to the
> from
>   page = shmem_alloc_page(..);
> to
>   page = &shmem_alloc_folio(..)->page;
> But in this case, instead of replacing, the setting of page was
> deleted.  So restore page with its new api.
> 
> ...
>
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2334,6 +2334,7 @@ int shmem_mfill_atomic_pte(struct mm_struct *dst_mm,
>  
>  	if (!*pagep) {
>  		ret = -ENOMEM;
> +		page = &shmem_alloc_folio(gfp, info, pgoff)->page;
>  		if (!page)
>  			goto out_unacct_blocks;
>  

Thanks, this is fixed in v2 of Matthew's "Folio patches for 5.19"
series.

I've just now pushed all that out to kernel.org so next linux-next
should be a happier place.

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

end of thread, other threads:[~2022-05-09 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 12:32 [PATCH] mm/shmem: restore setting of page variable Tom Rix
2022-05-09 18:03 ` 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).