From: Arnd Bergmann <arnd@kernel.org>
To: linux-kernel@vger.kernel.org,
Ryusuke Konishi <konishi.ryusuke@gmail.com>,
Nathan Chancellor <nathan@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Philipp Stanner <pstanner@redhat.com>,
Christian Brauner <brauner@kernel.org>,
Jeff Layton <jlayton@kernel.org>,
Thorsten Blum <thorsten.blum@toblux.com>,
linux-nilfs@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH 6/9] nilfs2: fix out-of-range warning
Date: Thu, 28 Mar 2024 15:30:44 +0100 [thread overview]
Message-ID: <20240328143051.1069575-7-arnd@kernel.org> (raw)
In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
clang-14 points out that v_size is always smaller than a 64KB
page size if that is configured by the CPU architecture:
fs/nilfs2/ioctl.c:63:19: error: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (argv->v_size > PAGE_SIZE)
~~~~~~~~~~~~ ^ ~~~~~~~~~
This is ok, so just shut up that warning with a cast.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
fs/nilfs2/ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index f1a01c191cf5..8be471ce4f19 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -60,7 +60,7 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
if (argv->v_nmembs == 0)
return 0;
- if (argv->v_size > PAGE_SIZE)
+ if ((size_t)argv->v_size > PAGE_SIZE)
return -EINVAL;
/*
--
2.39.2
next prev parent reply other threads:[~2024-03-28 14:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 14:30 [PATCH 0/9] address remaining -Wtautological-constant-out-of-range-compare Arnd Bergmann
2024-03-28 14:30 ` Arnd Bergmann [this message]
2024-03-28 15:21 ` [PATCH 6/9] nilfs2: fix out-of-range warning Philipp Stanner
2024-03-28 16:12 ` Arnd Bergmann
2024-03-28 22:04 ` Justin Stitt
2024-03-28 22:25 ` Arnd Bergmann
2024-03-29 9:20 ` Ryusuke Konishi
2024-04-01 8:50 ` (subset) " Christian Brauner
2024-03-29 20:00 ` [PATCH 0/9] address remaining -Wtautological-constant-out-of-range-compare patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240328143051.1069575-7-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=brauner@kernel.org \
--cc=jlayton@kernel.org \
--cc=justinstitt@google.com \
--cc=konishi.ryusuke@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nilfs@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=pstanner@redhat.com \
--cc=thorsten.blum@toblux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).