From: Matthew Wilcox (Oracle) Date: Thu, 9 Nov 2023 21:06:05 +0000 (+0000) Subject: buffer: cast block to loff_t before shifting it X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8c604ec716e0c8939e7027ebc546f39ece538213;p=users%2Fjedix%2Flinux-maple.git buffer: cast block to loff_t before shifting it 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. Link: https://lkml.kernel.org/r/20231109210608.2252323-5-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Cc: Hannes Reinecke Cc: Luis Chamberlain Cc: Pankaj Raghav Cc: Ryusuke Konishi Signed-off-by: Andrew Morton --- 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;