From: void0red <void0red@gmail.com>
To: willy@infradead.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
void0red <void0red@gmail.com>
Subject: [PATCH] xa_load() needs a NULL check before locking check
Date: Wed, 15 Feb 2023 21:14:17 +0800 [thread overview]
Message-ID: <20230215131417.150170-1-void0red@gmail.com> (raw)
Signed-off-by: void0red <void0red@gmail.com>
---
include/linux/pagemap.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index bbccb4044222..f1ddee3571de 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -1250,6 +1250,10 @@ static inline struct folio *__readahead_folio(struct readahead_control *ractl)
}
folio = xa_load(&ractl->mapping->i_pages, ractl->_index);
+ if (!folio) {
+ VM_BUG_ON(!folio);
+ return NULL;
+ }
VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
ractl->_batch_count = folio_nr_pages(folio);
--
2.34.1
next reply other threads:[~2023-02-15 13:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 13:14 void0red [this message]
2023-02-15 13:31 ` [PATCH] xa_load() needs a NULL check before locking check Matthew Wilcox
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=20230215131417.150170-1-void0red@gmail.com \
--to=void0red@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.