diff mbox series

[v2,4/7] buffer: Cast block to loff_t before shifting it

Message ID 20231109210608.2252323-5-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series More buffer_head cleanups | expand

Commit Message

Matthew Wilcox Nov. 9, 2023, 9:06 p.m. UTC
While sector_t is always defined as a u64 today, that hasn't always been
the case and it might not always be the same size as loff_t in the future.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/buffer.c b/fs/buffer.c
index 9c3f49cf8d28..ab345fd4da12 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2008,7 +2008,7 @@  static int
 iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
 		const struct iomap *iomap)
 {
-	loff_t offset = block << inode->i_blkbits;
+	loff_t offset = (loff_t)block << inode->i_blkbits;
 
 	bh->b_bdev = iomap->bdev;