From: Chao Yu <chao2.yu@samsung.com>
To: "'Jaegeuk Kim'" <jaegeuk@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: RE: [f2fs-dev] [PATCH 2/4] f2fs: return early when trying to read null nid
Date: Thu, 24 Dec 2015 13:49:24 +0800 [thread overview]
Message-ID: <015401d13e0e$f214f8e0$d63eeaa0$@samsung.com> (raw)
In-Reply-To: <1450923320-41113-2-git-send-email-jaegeuk@kernel.org>
Hi Jaegeuk,
> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Thursday, December 24, 2015 10:15 AM
> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 2/4] f2fs: return early when trying to read null nid
>
> 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.
Good catch!
>
> 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);
How about expand to check upper and lower boundary:
if (check_nid_range)
return ERR_PTR(-ENOENT);
Thanks,
> repeat:
> page = grab_cache_page(NODE_MAPPING(sbi), nid);
> if (!page)
> --
> 2.5.4 (Apple Git-61)
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2015-12-24 5:50 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 ` [PATCH 2/4] f2fs: return early when trying to read null nid Jaegeuk Kim
2015-12-24 5:49 ` Chao Yu [this message]
2015-12-24 20:15 ` [f2fs-dev] " 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='015401d13e0e$f214f8e0$d63eeaa0$@samsung.com' \
--to=chao2.yu@samsung.com \
--cc=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