Skip to contentSkip to conversation

f2fs: fix bad prefetchw of NULL page

PATCH New Kinglong Mee 1 participant 1 message Mar 13, 2017 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: fix bad prefetchw of NULL page

For f2fs_read_data_pages, the f2fs_mpage_readpages gets "page == NULL", so that, the prefetchw(&page->flags) is operated on NULL.

Fixes f1e8866016 ("f2fs: expose f2fs_mpage_readpages")
---
 fs/f2fs/data.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/data.c +2 -1
index 1375fef..2ab5ca0 100644
@@ -1150,9 +1150,10 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
 
 	for (page_idx = 0; nr_pages; page_idx++, nr_pages--) {
 
-		prefetchw(&page->flags);
 		if (pages) {
 			page = list_last_entry(pages, struct page, lru);
+
+			prefetchw(&page->flags);
 			list_del(&page->lru);
 			if (add_to_page_cache_lru(page, mapping,
 						  page->index,
Signature · 9 lines
2.9.3


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford