From: Changman Lee Date: Tue, 19 Feb 2013 22:47:06 +0000 (+0900) Subject: f2fs: check the level before calling get_nid function X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=52c2db3f95ff8e8d9650885d6d66b8258ded1e38;p=openwrt%2Fstaging%2Fblogic.git f2fs: check the level before calling get_nid function The caller of get_nid should be careful not to put lower value than NODE_DIR1_BLOCK in case of level is zero. Signed-off-by: Changman Lee Reviewed-by: Namjae Jeon Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 65ec2eabb392..d408e69294c8 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -403,7 +403,8 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode) return PTR_ERR(npage[0]); parent = npage[0]; - nids[1] = get_nid(parent, offset[0], true); + if (level != 0) + nids[1] = get_nid(parent, offset[0], true); dn->inode_page = npage[0]; dn->inode_page_locked = true;