Skip to contentSkip to conversation

mm/shmem: restore setting of page variable

PATCH In review Tom Rix 2 participants 2 messages May 9, 2022

Subsystems (2)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 mm/shmem: restore setting of page variable

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()")
---
 mm/shmem.c | 1 +
 1 file changed, 1 insertion(+)
mm/shmem.c +1 -0
index 7faaa61ff7fa..a2234f19b711 100644
@@ -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;
 
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 18 lines · On Mon, 9 May 2022 08:32:32 -0400 Tom Rix <[email protected]> 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.

...

mm/shmem.c int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, · line 2340

Quoted 7 lines
mm/shmem.c +1 -0
@@ -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.