Skip to content

Commit

Permalink
ocfs2: one function call less in user_cluster_connect() after error d…
Browse files Browse the repository at this point in the history
…etection

kfree() was called by user_cluster_connect() even if a previous call of
the kzalloc() function failed.

Return from this implementation directly after failure detection.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Markus Elfring authored and Linus Torvalds committed Apr 14, 2015
1 parent bb34ed2 commit 43ee9ca
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/ocfs2/stack_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1004,10 +1004,8 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
BUG_ON(conn == NULL);

lc = kzalloc(sizeof(struct ocfs2_live_connection), GFP_KERNEL);
if (!lc) {
rc = -ENOMEM;
goto out;
}
if (!lc)
return -ENOMEM;

init_waitqueue_head(&lc->oc_wait);
init_completion(&lc->oc_sync_wait);
Expand Down

0 comments on commit 43ee9ca

Please sign in to comment.