All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>
Subject: [PATCH 6/7] udf: Fix extension of the last extent in the file
Date: Thu, 22 Dec 2022 11:16:03 +0100	[thread overview]
Message-ID: <20221222101612.18814-6-jack@suse.cz> (raw)
In-Reply-To: <20221222101300.12679-1-jack@suse.cz>

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 --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;
 
-- 
2.35.3


  parent reply	other threads:[~2022-12-22 10:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 10:15 [PATCH 0/7] udf: Couple more fixes for extent and directory handling Jan Kara
2022-12-22 10:15 ` [PATCH 1/7] udf: Handle error when expanding directory Jan Kara
2022-12-22 10:15 ` [PATCH 2/7] udf: Handle error when adding extent to symlink Jan Kara
2022-12-22 10:16 ` [PATCH 3/7] udf: Handle error when adding extent to a file Jan Kara
2022-12-26  4:28   ` Nathan Chancellor
2023-01-02 12:51     ` Jan Kara
2022-12-22 10:16 ` [PATCH 4/7] udf: Allocate name buffer in directory iterator on heap Jan Kara
2022-12-22 10:16 ` [PATCH 5/7] udf: Move setting of i_lenExtents into udf_do_extend_file() Jan Kara
2022-12-22 10:16 ` Jan Kara [this message]
2022-12-22 10:16 ` [PATCH 7/7] udf: Keep i_lenExtents consistent with the total length of extents Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221222101612.18814-6-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.