[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250314155447.124842-1-arnd@kernel.org>
Date: Fri, 14 Mar 2025 16:54:41 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>,
Qu Wenruo <wqu@...e.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Johannes Thumshirn <johannes.thumshirn@....com>,
Filipe Manana <fdmanana@...e.com>,
Li Zetao <lizetao1@...wei.com>,
linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] btrfs: fix signedness issue in min()
From: Arnd Bergmann <arnd@...db.de>
Comparing a u64 to an loff_t causes a warning in min()
fs/btrfs/extent_io.c: In function 'extent_write_locked_range':
include/linux/compiler_types.h:557:45: error: call to '__compiletime_assert_588' declared with attribute error: min(folio_pos(folio) + folio_size(folio) - 1, end) signedness error
fs/btrfs/extent_io.c:2472:27: note: in expansion of macro 'min'
2472 | cur_end = min(folio_pos(folio) + folio_size(folio) - 1, end);
| ^~~
Use min_t() instead.
Fixes: f286b1c72175 ("btrfs: prepare extent_io.c for future larger folio support")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
fs/btrfs/extent_io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index c2451194be66..88bced0bfa51 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2468,7 +2468,7 @@ void extent_write_locked_range(struct inode *inode, const struct folio *locked_f
continue;
}
- cur_end = min(folio_pos(folio) + folio_size(folio) - 1, end);
+ cur_end = min_t(u64, folio_pos(folio) + folio_size(folio) - 1, end);
cur_len = cur_end + 1 - cur;
ASSERT(folio_test_locked(folio));
--
2.39.5
Powered by blists - more mailing lists