linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-mm@kvack.org
Subject: Re: [bug report] mm: convert ksm_might_need_to_copy() to work on folios
Date: Wed, 13 Dec 2023 15:37:25 +0000	[thread overview]
Message-ID: <ZXnPtblC6A1IkyAB@casper.infradead.org> (raw)
In-Reply-To: <a07e5aad-2b09-4966-b486-4791619dceae@moroto.mountain>

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);


      reply	other threads:[~2023-12-13 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13  7:01 Dan Carpenter
2023-12-13 15:37 ` Matthew Wilcox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZXnPtblC6A1IkyAB@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox