From: Arnd Bergmann <arnd@kernel.org>
To: Jens Axboe <axboe@kernel.dk>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Martijn Coenen <maco@android.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Dan Schatzberg <schatzberg.dan@gmail.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: [PATCH] loop: avoid out-of-range warning
Date: Mon, 27 Sep 2021 11:43:00 +0200 [thread overview]
Message-ID: <20210927094327.644665-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
clang warns that the sanity check for page size always succeeds
when building with 64KB pages:
drivers/block/loop.c:282:27: error: result of comparison of constant 65536 with expression of type 'unsigned short' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
~~~~~ ^ ~~~~~~~~~
There is nothing wrong here, so just shut up the check by changing
the type of the bsize argument.
Fixes: 3448914e8cc5 ("loop: Add LOOP_CONFIGURE ioctl")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/block/loop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 7bf4686af774..51315a93b399 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -277,7 +277,7 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
* @bsize: size to validate
*/
static int
-loop_validate_block_size(unsigned short bsize)
+loop_validate_block_size(unsigned int bsize)
{
if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
return -EINVAL;
--
2.29.2
next reply other threads:[~2021-09-27 9:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 9:43 Arnd Bergmann [this message]
2021-09-27 9:51 ` [PATCH] loop: avoid out-of-range warning Martijn Coenen
2021-09-27 11:16 ` Tetsuo Handa
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=20210927094327.644665-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=maco@android.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=schatzberg.dan@gmail.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