[PATCH] fuse: ioctl: fix comparison in fuse_setup_measure_verity()
From: Ali Nasrollahi
Date: Thu Aug 13 2026 - 03:07:43 EST
Clang reports a warning in fuse_setup_measure_verity() in
fs/fuse/ioctl.c when comparing the `__u16 digest_size` with SIZE_MAX
minus the size of `struct fsverity_digest`:
warning: result of comparison of constant 18446744073709551611
with expression of type '__u16' (aka 'unsigned short') is always
false [-Wtautological-constant-out-of-range-compare]
This was first observed while building an x86_64 kernel with Clang and
W=1. Since -Werror was enabled in my build, the warning caused the build
to fail.
However, the same warning can also be reproduced with the same build
options using tinyconfig with FUSE enabled, so this is not specific to
the kernel configuration used in the original build.
The comparison is between the 16-bit digest_size and a size_t-sized
constant. Cast digest_size to size_t so that the comparison is performed
using the same type as the size calculation.
Signed-off-by: Ali Nasrollahi <A.Nasrolahi01@xxxxxxxxx>
---
fs/fuse/ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c
index 3614ea603913..3487e30d997c 100644
--- a/fs/fuse/ioctl.c
+++ b/fs/fuse/ioctl.c
@@ -130,7 +130,7 @@ static int fuse_setup_measure_verity(unsigned long arg, struct iovec *iov)
if (copy_from_user(&digest_size, &uarg->digest_size, sizeof(digest_size)))
return -EFAULT;
- if (digest_size > SIZE_MAX - sizeof(struct fsverity_digest))
+ if ((size_t)digest_size > SIZE_MAX - sizeof(struct fsverity_digest))
return -EINVAL;
iov->iov_len = sizeof(struct fsverity_digest) + digest_size;
--
2.55.0