[PATCH v2] fuse: ioctl: remove unnecessary comparison in fuse_setup_measure_verity()
Ali Nasrollahi <[email protected]>
| Newsgroups | dev.linux.lists.fuse-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Clang reports a warning in fuse_setup_measure_verity() 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. 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. Since this comparison cannot be true, remove it. Signed-off-by: Ali Nasrollahi <[email protected]> --- Changes in v2: - Remove the comparison instead of casting digest_size. --- fs/fuse/ioctl.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c index 3614ea603913..dc3a188f5d72 100644 --- a/fs/fuse/ioctl.c +++ b/fs/fuse/ioctl.c @@ -130,9 +130,6 @@ 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)) - return -EINVAL; - iov->iov_len = sizeof(struct fsverity_digest) + digest_size; return 0; -- 2.55.0