]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/6.6.26/dm-integrity-fix-out-of-range-warning.patch
Linux 6.6.26
[thirdparty/kernel/stable-queue.git] / releases / 6.6.26 / dm-integrity-fix-out-of-range-warning.patch
CommitLineData
ffc1c2fe
SL
1From 54c197f1ea29e19992dff8613fdb553ef556c0f3 Mon Sep 17 00:00:00 2001
2From: Sasha Levin <sashal@kernel.org>
3Date: Thu, 28 Mar 2024 15:30:39 +0100
4Subject: dm integrity: fix out-of-range warning
5
6From: Arnd Bergmann <arnd@arndb.de>
7
8[ Upstream commit 8e91c2342351e0f5ef6c0a704384a7f6fc70c3b2 ]
9
10Depending on the value of CONFIG_HZ, clang complains about a pointless
11comparison:
12
13drivers/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
19As the check remains useful for other configurations, shut up the
20warning by adding a second type cast to uint64_t.
21
22Fixes: 468dfca38b1a ("dm integrity: add a bitmap mode")
23Signed-off-by: Arnd Bergmann <arnd@arndb.de>
24Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
25Reviewed-by: Justin Stitt <justinstitt@google.com>
26Signed-off-by: Mike Snitzer <snitzer@kernel.org>
27Signed-off-by: Sasha Levin <sashal@kernel.org>
28---
29 drivers/md/dm-integrity.c | 2 +-
30 1 file changed, 1 insertion(+), 1 deletion(-)
31
32diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
33index 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--
462.43.0
47