From: Matthew Wilcox <willy@infradead.org>
To: cgel.zte@gmail.com
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, chiminghao <chi.minghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>,
Julia Lawall <julia.lawall@lip6.fr>,
Michal Marek <mmarek@suse.com>
Subject: Re: [PATCH] mm: Use BUG_ON instead of if condition followed by BUG
Date: Thu, 25 Nov 2021 00:00:39 +0000 [thread overview]
Message-ID: <YZ7SJ8sXtXF4lZ4L@casper.infradead.org> (raw)
In-Reply-To: <YZ483gwnwTysPt0G@casper.infradead.org>
On Wed, Nov 24, 2021 at 01:23:42PM +0000, Matthew Wilcox wrote:
> On Wed, Nov 24, 2021 at 03:08:49AM +0000, cgel.zte@gmail.com wrote:
> > From: chiminghao <chi.minghao@zte.com.cn>
> >
> > Fix the following coccinelle report:
> > ./mm/memory_hotplug.c:2210:2-5:
> > WARNING Use BUG_ON instead of if condition followed by BUG.
>
> What coccinelle script is reporting this?
Maybe I found it?
scripts/coccinelle/misc/bugon.cocci:msg="WARNING: Use BUG_ON instead of if condition followed by BUG.\nPlease make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h)"
Julia, Michal, can we delete this script, please? It's being abused.
> > - if (try_remove_memory(start, size))
> > - BUG();
> > + BUG_ON(try_remove_memory(start, size));
>
> I really, really, really do not like this. For functions with
> side-effects, this is bad style. If it's a pure predicate, then
> sure, but this is bad.
>
next prev parent reply other threads:[~2021-11-25 0:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 3:08 cgel.zte
2021-11-24 11:10 ` David Hildenbrand
2021-11-24 13:23 ` Matthew Wilcox
2021-11-24 22:27 ` Andrew Morton
2021-11-24 22:45 ` John Hubbard
2021-11-25 3:32 ` Matthew Wilcox
2021-11-25 5:29 ` John Hubbard
2021-11-25 0:00 ` Matthew Wilcox [this message]
2021-11-27 18:05 ` Julia Lawall
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=YZ7SJ8sXtXF4lZ4L@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=cgel.zte@gmail.com \
--cc=chi.minghao@zte.com.cn \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mmarek@suse.com \
--cc=zealci@zte.com.cn \
/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