linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH 2/4] f2fs: return early when trying to read null nid
Date: Wed, 23 Dec 2015 18:15:18 -0800	[thread overview]
Message-ID: <1450923320-41113-2-git-send-email-jaegeuk@kernel.org> (raw)
In-Reply-To: <1450923320-41113-1-git-send-email-jaegeuk@kernel.org>

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)


------------------------------------------------------------------------------

  reply	other threads:[~2015-12-24  2:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-24  2:15 [PATCH 1/4] f2fs: introduce prepare_write_begin to clean up Jaegeuk Kim
2015-12-24  2:15 ` Jaegeuk Kim [this message]
2015-12-24  5:49   ` [f2fs-dev] [PATCH 2/4] f2fs: return early when trying to read null nid Chao Yu
2015-12-24 20:15     ` Jaegeuk Kim
2015-12-25  0:57       ` Chao Yu
2015-12-24  2:15 ` [PATCH 3/4] f2fs: avoid f2fs_lock_op in f2fs_write_begin Jaegeuk Kim
2015-12-24  5:50   ` [f2fs-dev] " Chao Yu
2015-12-24 20:33     ` Jaegeuk Kim
2015-12-24 21:51       ` Jaegeuk Kim
2015-12-25  1:18         ` Chao Yu
2015-12-25  1:40           ` Jaegeuk Kim
2015-12-24  2:15 ` [PATCH 4/4] f2fs: declare static function Jaegeuk Kim

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=1450923320-41113-2-git-send-email-jaegeuk@kernel.org \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).