* re: mm/shmem: turn shmem_alloc_page() into shmem_alloc_folio()
@ 2022-05-04 13:36 Colin King (gmail)
0 siblings, 0 replies; only message in thread
From: Colin King (gmail) @ 2022-05-04 13:36 UTC (permalink / raw)
To: Andrew Morton, Linux-MM, Hugh Dickins, Matthew Wilcox (Oracle)
Cc: linux-kernel@vger.kernel.org
Hi,
Static analysis with clang scan-build found an issue in the following
commit:
commit b0bb08b2d5f399369a906eff0287e64b531881d8
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date: Fri Apr 29 14:43:02 2022 -0700
mm/shmem: turn shmem_alloc_page() into shmem_alloc_folio()
The issue is as follows:
#ifdef CONFIG_USERFAULTFD
int shmem_mfill_atomic_pte(struct mm_struct *dst_mm,
pmd_t *dst_pmd,
struct vm_area_struct *dst_vma,
unsigned long dst_addr,
unsigned long src_addr,
bool zeropage, bool wp_copy,
struct page **pagep)
{
struct inode *inode = file_inode(dst_vma->vm_file);
struct shmem_inode_info *info = SHMEM_I(inode);
struct address_space *mapping = inode->i_mapping;
gfp_t gfp = mapping_gfp_mask(mapping);
pgoff_t pgoff = linear_page_index(dst_vma, dst_addr);
void *page_kaddr;
struct folio *folio;
struct page *page;
^^ page is not intialized
int ret;
pgoff_t max_off;
if (!shmem_inode_acct_block(inode, 1)) {
/*
* We may have got a page, returned -ENOENT triggering
a retry,
* and now we find ourselves with -ENOMEM. Release the
page, to
* avoid a BUG_ON in our caller.
*/
if (unlikely(*pagep)) {
put_page(*pagep);
*pagep = NULL;
}
return -ENOMEM;
}
if (!*pagep) {
ret = -ENOMEM;
if (!page)
goto out_unacct_blocks;
^^ page is being referenced but it has not been set
The commit in question removed the assignment to page:
if (!*pagep) {
ret = -ENOMEM;
- page = shmem_alloc_page(gfp, info, pgoff);
if (!page)
goto out_unacct_blocks;
Colin
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-04 13:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-04 13:36 mm/shmem: turn shmem_alloc_page() into shmem_alloc_folio() Colin King (gmail)
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).