On Wed, Dec 13, 2023 at 10:01:46AM +0300, Dan Carpenter wrote: > Hello Matthew Wilcox (Oracle), > > The patch 6faef19bdfcc: "mm: convert ksm_might_need_to_copy() to work > on folios" from Dec 11, 2023 (linux-next), leads to the following > Smatch static checker warning: > > mm/memory.c:4118 do_swap_page() > error: 'folio' dereferencing possible ERR_PTR() Right! Andrew, please squash in: diff --git a/mm/memory.c b/mm/memory.c index 318f923134e4..1270d70dcb80 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3945,9 +3945,11 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) folio = ksm_might_need_to_copy(folio, vma, vmf->address); if (unlikely(!folio)) { ret = VM_FAULT_OOM; + folio = swapcache; goto out_page; } else if (unlikely(folio == ERR_PTR(-EHWPOISON))) { ret = VM_FAULT_HWPOISON; + folio = swapcache; goto out_page; } page = folio_page(folio, 0);