Skip to content

Commit

Permalink
ocfs2: Init meta_ac properly in ocfs2_create_empty_xattr_block.
Browse files Browse the repository at this point in the history
You can't store a pointer that you haven't filled in yet and expect it
to work.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
  • Loading branch information
Tao Ma authored and Joel Becker committed Mar 19, 2010
1 parent dfe4d3d commit b231796
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fs/ocfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6528,13 +6528,11 @@ static int ocfs2_create_empty_xattr_block(struct inode *inode,
int indexed)
{
int ret;
struct ocfs2_alloc_context *meta_ac;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
struct ocfs2_xattr_set_ctxt ctxt = {
.meta_ac = meta_ac,
};
struct ocfs2_xattr_set_ctxt ctxt;

ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac);
memset(&ctxt, 0, sizeof(ctxt));
ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &ctxt.meta_ac);
if (ret < 0) {
mlog_errno(ret);
return ret;
Expand All @@ -6556,7 +6554,7 @@ static int ocfs2_create_empty_xattr_block(struct inode *inode,

ocfs2_commit_trans(osb, ctxt.handle);
out:
ocfs2_free_alloc_context(meta_ac);
ocfs2_free_alloc_context(ctxt.meta_ac);
return ret;
}

Expand Down

0 comments on commit b231796

Please sign in to comment.