]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/dm-integrity-fix-out-of-range-warning.patch
Linux 6.1.85
[thirdparty/kernel/stable-queue.git] / queue-6.6 / dm-integrity-fix-out-of-range-warning.patch
1 From 54c197f1ea29e19992dff8613fdb553ef556c0f3 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Thu, 28 Mar 2024 15:30:39 +0100
4 Subject: dm integrity: fix out-of-range warning
5
6 From: Arnd Bergmann <arnd@arndb.de>
7
8 [ Upstream commit 8e91c2342351e0f5ef6c0a704384a7f6fc70c3b2 ]
9
10 Depending on the value of CONFIG_HZ, clang complains about a pointless
11 comparison:
12
13 drivers/md/dm-integrity.c:4085:12: error: result of comparison of
14 constant 42949672950 with expression of type
15 'unsigned int' is always false
16 [-Werror,-Wtautological-constant-out-of-range-compare]
17 if (val >= (uint64_t)UINT_MAX * 1000 / HZ) {
18
19 As the check remains useful for other configurations, shut up the
20 warning by adding a second type cast to uint64_t.
21
22 Fixes: 468dfca38b1a ("dm integrity: add a bitmap mode")
23 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
24 Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
25 Reviewed-by: Justin Stitt <justinstitt@google.com>
26 Signed-off-by: Mike Snitzer <snitzer@kernel.org>
27 Signed-off-by: Sasha Levin <sashal@kernel.org>
28 ---
29 drivers/md/dm-integrity.c | 2 +-
30 1 file changed, 1 insertion(+), 1 deletion(-)
31
32 diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
33 index e7cd27e387df1..470add73f7bda 100644
34 --- a/drivers/md/dm-integrity.c
35 +++ b/drivers/md/dm-integrity.c
36 @@ -4231,7 +4231,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
37 } else if (sscanf(opt_string, "sectors_per_bit:%llu%c", &llval, &dummy) == 1) {
38 log2_sectors_per_bitmap_bit = !llval ? 0 : __ilog2_u64(llval);
39 } else if (sscanf(opt_string, "bitmap_flush_interval:%u%c", &val, &dummy) == 1) {
40 - if (val >= (uint64_t)UINT_MAX * 1000 / HZ) {
41 + if ((uint64_t)val >= (uint64_t)UINT_MAX * 1000 / HZ) {
42 r = -EINVAL;
43 ti->error = "Invalid bitmap_flush_interval argument";
44 goto bad;
45 --
46 2.43.0
47