Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297723

[PATCH 2/4] f2fs: return early when trying to read null nid

From Jaegeuk Kim <jaegeuk@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 2/4] f2fs: return early when trying to read null nid
Date 2015-12-24 03:20 +0100
Message-ID <qJ3Fv-Na-5@gated-at.bofh.it> (permalink)
References <qJ3Fv-Na-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If get_node_page() gets zero nid, we can return early without getting a wrong
page. For example, get_dnode_of_data() can try to do that.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/node.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 341de5d..e17128d 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1059,6 +1059,9 @@ struct page *get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid)
 {
 	struct page *page;
 	int err;
+
+	if (!nid)
+		return ERR_PTR(-ENOENT);
 repeat:
 	page = grab_cache_page(NODE_MAPPING(sbi), nid);
 	if (!page)
-- 
2.5.4 (Apple Git-61)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 2/4] f2fs: return early when trying to read null nid Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-24 03:20 +0100
  RE: [f2fs-dev] [PATCH 2/4] f2fs: return early when trying to read null  nid Chao Yu <chao2.yu@samsung.com> - 2015-12-24 07:00 +0100
    Re: [f2fs-dev] [PATCH 2/4] f2fs: return early when trying to read  null nid Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-24 21:20 +0100
      RE: [f2fs-dev] [PATCH 2/4] f2fs: return early when trying to read null  nid Chao Yu <chao2.yu@samsung.com> - 2015-12-25 02:00 +0100

csiph-web