OSDN Git Service

libext2fs: ind_punch() must not stop examining blocks prematurely
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 7 Oct 2013 13:51:35 +0000 (09:51 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 7 Oct 2013 13:51:35 +0000 (09:51 -0400)
commit581646b94f3b57a461105968b49105a1357216ea
treee2e16fc538a9d3e255adc076b415a42ffc4d5685
parent4ee4ad80dcceb42b1e5cfd2d4067a38b99b9fa95
libext2fs: ind_punch() must not stop examining blocks prematurely

When we're iterating the main loop in ind_punch(), "offset" tracks how
far we've progressed into the block map, "start" tells us where to
start punching, and "count" tells us how many blocks we are to punch
after "start".  Therefore, we would like to break out of the loop once
the "offset" that we're looking at has progressed past the end of the
punch range.  Unfortunately, if start !=0, the if-break clause in the
loop causes us to break out of the loop early.

Therefore, change the breakout test to terminate the loop at the
correct time.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/punch.c