f2fs: check the level before calling get_nid function
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- fs/f2fs/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/node.c +2 -1
@@ -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;
Signature · 1 line
1.7.10.4
2013/2/20, Changman Lee <[email protected]>:
Quoted 4 lines
The caller of
get_nidshould be careful not to put lower value thanNODE_DIR1_BLOCKin case of level is zero.Signed-off-by Changman Lee <[email protected]>
Good catch. we don't really need to add incorrect value in case level is 0.
Reviewed-by Namjae Jeon <[email protected]>
Thanks.
Quoted 1 line
---