All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: Karl Mehltretter <kmehltretter@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Wei Yang <richard.weiyang@gmail.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] lib/interval_tree: fix allocation warning messages
Date: Sun, 9 Aug 2026 01:44:58 +0000	[thread overview]
Message-ID: <20260809014458.b4bqt2t6sx5s4rrl@master> (raw)
In-Reply-To: <20260808123608.73613-1-kmehltretter@gmail.com>

On Sat, Aug 08, 2026 at 02:36:08PM +0200, Karl Mehltretter wrote:
>WARN_ON_ONCE() takes a condition, not a message. The string literals
>are always true, so the warnings still trigger but the messages are
>never printed.
>
>Use WARN_ONCE(1, ...) instead to print the messages and keep the
>once-only behavior.
>
>Found with a Coccinelle script. Clang's -Wstring-conversion also flags
>such calls but is not enabled in kernel builds.
>
>Fixes: 82114e45131f ("lib/interval_tree: add test case for interval_tree_iter_xxx() helpers")
>Assisted-by: Claude:claude-fable-5 coccinelle
>Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>

Oops, thanks for fixing it.

Reviewed-by: Wei Yang <richard.weiyang@gmail.com>

>---
> lib/interval_tree_test.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/lib/interval_tree_test.c b/lib/interval_tree_test.c
>index eba2d3e28980..b0b07270ce7c 100644
>--- a/lib/interval_tree_test.c
>+++ b/lib/interval_tree_test.c
>@@ -140,13 +140,13 @@ static int intersection_range_check(void)
> 
> 	intxn1 = bitmap_alloc(nnodes, GFP_KERNEL);
> 	if (!intxn1) {
>-		WARN_ON_ONCE("Failed to allocate intxn1\n");
>+		WARN_ONCE(1, "Failed to allocate intxn1\n");
> 		return -ENOMEM;
> 	}
> 
> 	intxn2 = bitmap_alloc(nnodes, GFP_KERNEL);
> 	if (!intxn2) {
>-		WARN_ON_ONCE("Failed to allocate intxn2\n");
>+		WARN_ONCE(1, "Failed to allocate intxn2\n");
> 		bitmap_free(intxn1);
> 		return -ENOMEM;
> 	}
>-- 
>2.39.5 (Apple Git-154)

-- 
Wei Yang
Help you, Help me

      parent reply	other threads:[~2026-08-09  1:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-08 12:36 [PATCH] lib/interval_tree: fix allocation warning messages Karl Mehltretter
2026-08-08 17:50 ` Andrew Morton
2026-08-08 18:55   ` Karl Mehltretter
2026-08-09  1:44 ` Wei Yang [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=20260809014458.b4bqt2t6sx5s4rrl@master \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.