From: Changman Lee Subject: [PATCH] f2fs: check the level before calling get_nid function Date: Wed, 20 Feb 2013 07:47:06 +0900 Message-ID: <1361314026-18548-1-git-send-email-cm224.lee@samsung.com> Cc: Changman Lee To: linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Return-path: Received: from mailout2.samsung.com ([203.254.224.25]:11780 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933373Ab3BSWpt (ORCPT ); Tue, 19 Feb 2013 17:45:49 -0500 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MIH001Z8OKA81B0@mailout2.samsung.com> for linux-fsdevel@vger.kernel.org; Wed, 20 Feb 2013 07:45:47 +0900 (KST) Received: from localhost.localdomain ([12.52.124.222]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MIH00AY8OK64D00@mmp1.samsung.com> for linux-fsdevel@vger.kernel.org; Wed, 20 Feb 2013 07:45:47 +0900 (KST) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- fs/f2fs/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index e275218..764c1d8 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 ro) 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; -- 1.7.10.4