linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Hannes Reinecke <hare@suse.de>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Pankaj Raghav <p.raghav@samsung.com>,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH 4/5] buffer: Cast block to loff_t before shifting it
Date: Tue,  7 Nov 2023 19:41:51 +0000	[thread overview]
Message-ID: <20231107194152.3374087-5-willy@infradead.org> (raw)
In-Reply-To: <20231107194152.3374087-1-willy@infradead.org>

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 --git a/fs/buffer.c b/fs/buffer.c
index c83bb89b2e24..2f08af3c47a2 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;
 
-- 
2.42.0


  parent reply	other threads:[~2023-11-07 19:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07 19:41 [PATCH 0/5] More buffer_head cleanups Matthew Wilcox (Oracle)
2023-11-07 19:41 ` [PATCH 1/5] buffer: Return bool from grow_dev_folio() Matthew Wilcox (Oracle)
2023-11-07 19:41 ` [PATCH 2/5] buffer: Calculate block number inside folio_init_buffers() Matthew Wilcox (Oracle)
     [not found]   ` <CGME20231108145953eucas1p2eeaf54e93c10cbf501a43f594e23438a@eucas1p2.samsung.com>
2023-11-08 14:59     ` Pankaj Raghav
2023-11-08 15:22       ` Matthew Wilcox
2023-11-08 17:30   ` kernel test robot
2023-11-07 19:41 ` [PATCH 3/5] buffer: Fix grow_buffers() for block size > PAGE_SIZE Matthew Wilcox (Oracle)
2023-11-07 19:41 ` Matthew Wilcox (Oracle) [this message]
2023-11-07 19:41 ` [PATCH 5/5] buffer: Fix various functions " Matthew Wilcox (Oracle)
     [not found]   ` <CGME20231108151744eucas1p229d2073ae889eb95caed90b1f83821c3@eucas1p2.samsung.com>
2023-11-08 15:17     ` Pankaj Raghav

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=20231107194152.3374087-5-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hare@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=p.raghav@samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).