Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8379e7c4 authored by Sunil Mushran's avatar Sunil Mushran Committed by Joel Becker
Browse files

ocfs2: ocfs2_write_begin_nolock() should handle len=0



Bug introduced by mainline commit e7432675
The bug causes ocfs2_write_begin_nolock() to oops when len=0.

Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
Cc: stable@kernel.org
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
parent a1b08e75
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1747,8 +1747,8 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
	 * we know zeros will only be needed in the first and/or last cluster.
	 */
	if (clusters_to_alloc || extents_to_split ||
	    wc->w_desc[0].c_needs_zero ||
	    wc->w_desc[wc->w_clen - 1].c_needs_zero)
	    (wc->w_clen && (wc->w_desc[0].c_needs_zero ||
			    wc->w_desc[wc->w_clen - 1].c_needs_zero)))
		cluster_of_pages = 1;
	else
		cluster_of_pages = 0;