public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Dave Kleikamp <shaggy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Yun Zhou <yun.zhou@windriver.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Aditya Dutt <duttaditya18@gmail.com>,
	Zheng Yu <zheng.yu@northwestern.edu>,
	jfs-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH] jfs: avoid -Wtautological-constant-out-of-range-compare warning again
Date: Mon, 16 Mar 2026 15:42:51 +0100	[thread overview]
Message-ID: <20260316144257.731006-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

The comparison of an __s8 value against DTPAGEMAXSLOT is still trivially
true, causing a harmless (default disabled) warning with clang:

fs/jfs/jfs_dtree.c:4419:25: 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]
 4419 |                                         p->header.freelist >= DTPAGEMAXSLOT)) {
      |                                         ~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~

I previously worked around two of these in commit 7833570dae83 ("jfs: avoid
-Wtautological-constant-out-of-range-compare warning"), but now a new one has
come up, so address the same way by dropping the redundant range check.

Fixes: 119e448bb50a ("jfs: add dtpage integrity check to prevent index/pointer overflows")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/jfs/jfs_dtree.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index 7669e268fe35..a32c78d1c416 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -4415,8 +4415,7 @@ bool check_dtpage(dtpage_t *p)
 		/* When there are free slots, freelist must be a valid slot index in
 		 * 1~DTROOTMAXSLOT-1(since slot[0] is occupied by the header).
 		 */
-		if (unlikely(p->header.freelist < 1 ||
-					p->header.freelist >= DTPAGEMAXSLOT)) {
+		if (unlikely(p->header.freelist < 1)) {
 			jfs_err("Bad freelist:%d in dtpage\n", p->header.freelist);
 			return false;
 		}
-- 
2.39.5


             reply	other threads:[~2026-03-16 14:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 14:42 Arnd Bergmann [this message]
2026-03-16 15:20 ` [Jfs-discussion] [PATCH] jfs: avoid -Wtautological-constant-out-of-range-compare warning again Dave Kleikamp

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=20260316144257.731006-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --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=shaggy@kernel.org \
    --cc=yun.zhou@windriver.com \
    --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