mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Dave Kleikamp" <dave.kleikamp@oracle.com>,
	"Arnd Bergmann" <arnd@kernel.org>,
	"Dave Kleikamp" <shaggy@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Zheng Yu" <zheng.yu@northwestern.edu>
Cc: "Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	"Aditya Dutt" <duttaditya18@gmail.com>,
	"Roman Smirnov" <r.smirnov@omp.ru>,
	jfs-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] jfs: avoid -Wtautological-constant-out-of-range-compare warning
Date: Mon, 02 Feb 2026 21:44:08 +0100	[thread overview]
Message-ID: <38f05cd4-6844-481a-8293-3b87f9f1a9c6@app.fastmail.com> (raw)
In-Reply-To: <fd1854c2-d3f1-4901-8b7d-c6ce944caf61@oracle.com>

On Mon, Feb 2, 2026, at 18:34, Dave Kleikamp wrote:
> On 2/2/26 3:49AM, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> A recent change for the range check started triggering a clang warning:
>> 
>> fs/jfs/jfs_dtree.c:2906:31: error: result of comparison of constant 128 with expression of type 's8' (aka 'signed char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>>   2906 |                         if (stbl[i] < 0 || stbl[i] >= DTPAGEMAXSLOT) {
>>        |                                            ~~~~~~~ ^  ~~~~~~~~~~~~~
>> fs/jfs/jfs_dtree.c:3111:30: error: result of comparison of constant 128 with expression of type 's8' (aka 'signed char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>>   3111 |                 if (stbl[0] < 0 || stbl[0] >= DTPAGEMAXSLOT) {
>>        |                                    ~~~~~~~ ^  ~~~~~~~~~~~~~
>> 
>> Both the old and the new check were useless, but the previous version
>> apparently did not lead to the warning.
>> 
>> Rephrase this again by adding a cast. The check is still always false,
>> but the compiler shuts up about it.
>
> I think it would be better to just drop the useless part of these tests.

Fair enough, sent v2 now.

      Arnd

      reply	other threads:[~2026-02-02 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02  9:49 Arnd Bergmann
2026-02-02 17:34 ` Dave Kleikamp
2026-02-02 20:44   ` Arnd Bergmann [this message]

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=38f05cd4-6844-481a-8293-3b87f9f1a9c6@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=dave.kleikamp@oracle.com \
    --cc=duttaditya18@gmail.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=r.smirnov@omp.ru \
    --cc=shaggy@kernel.org \
    --cc=zheng.yu@northwestern.edu \
    /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

all inboxes | Powered by JetHome®