Skip to content

Commit

Permalink
exfat: fix potential wrong error return from get_block
Browse files Browse the repository at this point in the history
If there is no error, get_block() should return 0. However, when bh_read()
returns 1, get_block() also returns 1 in the same manner.

Let's set err to 0, if there is no error from bh_read()

Fixes: 11a347f ("exfat: change to get file size from DataLength")
Cc: stable@vger.kernel.org
Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
  • Loading branch information
Sungjong Seo authored and Namjae Jeon committed Mar 29, 2025
1 parent 47e3536 commit 59c30e3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/exfat/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ static int exfat_get_block(struct inode *inode, sector_t iblock,
/* Zero unwritten part of a block */
memset(bh_result->b_data + size, 0,
bh_result->b_size - size);

err = 0;
} else {
/*
* The range has not been written, clear the mapped flag
Expand Down

0 comments on commit 59c30e3

Please sign in to comment.