[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240328143051.1069575-4-arnd@kernel.org>
Date: Thu, 28 Mar 2024 15:30:41 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: linux-kernel@...r.kernel.org,
Ilya Dryomov <idryomov@...il.com>,
Jens Axboe <axboe@...nel.dk>,
Nathan Chancellor <nathan@...nel.org>,
Alex Elder <elder@...tank.com>,
Josh Durgin <josh.durgin@...tank.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Dongsheng Yang <dongsheng.yang@...ystack.cn>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Hannes Reinecke <hare@...e.de>,
Christian Brauner <brauner@...nel.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
"Ricardo B. Marliere" <ricardo@...liere.net>,
Jinjie Ruan <ruanjinjie@...wei.com>,
Alex Elder <elder@...aro.org>,
ceph-devel@...r.kernel.org,
linux-block@...r.kernel.org,
llvm@...ts.linux.dev
Subject: [PATCH 3/9] rbd: avoid out-of-range warning
From: Arnd Bergmann <arnd@...db.de>
clang-14 points out that the range check is always true on 64-bit
architectures since a u32 is not greater than the allowed size:
drivers/block/rbd.c:6079:17: error: result of comparison of constant 2305843009213693948 with expression of type 'u32' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (snap_count > (SIZE_MAX - sizeof (struct ceph_snap_context))
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is harmless, so just change the type of the temporary to size_t
to shut up that warning.
Fixes: bb23e37acb2a ("rbd: refactor rbd_header_from_disk()")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/block/rbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 26ff5cd2bf0a..cb25ee513ada 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -6062,7 +6062,7 @@ static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev,
void *p;
void *end;
u64 seq;
- u32 snap_count;
+ size_t snap_count;
struct ceph_snap_context *snapc;
u32 i;
--
2.39.2
Powered by blists - more mailing lists