Skip to content

Commit bdd000c

Browse files
arndbgregkh
authored andcommitted
dm integrity: fix out-of-range warning
[ Upstream commit 8e91c23 ] Depending on the value of CONFIG_HZ, clang complains about a pointless comparison: drivers/md/dm-integrity.c:4085:12: error: result of comparison of constant 42949672950 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (val >= (uint64_t)UINT_MAX * 1000 / HZ) { As the check remains useful for other configurations, shut up the warning by adding a second type cast to uint64_t. Fixes: 468dfca ("dm integrity: add a bitmap mode") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Justin Stitt <justinstitt@google.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 706d6d6 commit bdd000c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/dm-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4221,7 +4221,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
42214221
} else if (sscanf(opt_string, "sectors_per_bit:%llu%c", &llval, &dummy) == 1) {
42224222
log2_sectors_per_bitmap_bit = !llval ? 0 : __ilog2_u64(llval);
42234223
} else if (sscanf(opt_string, "bitmap_flush_interval:%u%c", &val, &dummy) == 1) {
4224-
if (val >= (uint64_t)UINT_MAX * 1000 / HZ) {
4224+
if ((uint64_t)val >= (uint64_t)UINT_MAX * 1000 / HZ) {
42254225
r = -EINVAL;
42264226
ti->error = "Invalid bitmap_flush_interval argument";
42274227
goto bad;

0 commit comments

Comments
 (0)