From: Jan Kara Date: Wed, 21 Dec 2022 16:45:51 +0000 (+0100) Subject: udf: Fix extension of the last extent in the file X-Git-Tag: v6.6.17~5804^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83c7423d1eb6806d13c521d1002cc1a012111719;p=platform%2Fkernel%2Flinux-rpi.git udf: Fix extension of the last extent in the file When extending the last extent in the file within the last block, we wrongly computed the length of the last extent. This is mostly a cosmetical problem since the extent does not contain any data and the length will be fixed up by following operations but still. Fixes: 1f3868f06855 ("udf: Fix extending file within last block") Signed-off-by: Jan Kara --- diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 1d7c2a8..f3e9889 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -595,7 +595,7 @@ static void udf_do_extend_final_block(struct inode *inode, */ if (new_elen <= (last_ext->extLength & UDF_EXTENT_LENGTH_MASK)) return; - added_bytes = (last_ext->extLength & UDF_EXTENT_LENGTH_MASK) - new_elen; + added_bytes = new_elen - (last_ext->extLength & UDF_EXTENT_LENGTH_MASK); last_ext->extLength += added_bytes; UDF_I(inode)->i_lenExtents += added_bytes;