mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] fuse: ioctl: remove unnecessary comparison in fuse_setup_measure_verity()
@ 2026-08-18 16:14 Ali Nasrollahi
  2026-08-25 12:35 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Ali Nasrollahi @ 2026-08-18 16:14 UTC (permalink / raw)
  To: fuse-devel; +Cc: miklos, linux-kernel, Ali Nasrollahi

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 <A.Nasrolahi01@gmail.com>

---
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-25 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-18 16:14 [PATCH v2] fuse: ioctl: remove unnecessary comparison in fuse_setup_measure_verity() Ali Nasrollahi
2026-08-25 12:35 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®