diff mbox series

[6/7] udf: Fix extension of the last extent in the file

Message ID 20221222101612.18814-6-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series udf: Couple more fixes for extent and directory handling | expand

Commit Message

Jan Kara Dec. 22, 2022, 10:16 a.m. UTC
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 <jack@suse.cz>
---
 fs/udf/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index fe5b0ba600fa..075e0a9d766c 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -516,7 +516,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;