Skip to content

Commit

Permalink
ocfs2: ocfs2_write_begin_nolock() should handle len=0
Browse files Browse the repository at this point in the history
commit 8379e7c upstream.

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

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Sunil Mushran authored and Greg Kroah-Hartman committed Sep 9, 2009
1 parent 94a92d5 commit e38d225
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ocfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1746,8 +1746,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;
Expand Down

0 comments on commit e38d225

Please sign in to comment.