[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2111271905050.2864@hadrien>
Date: Sat, 27 Nov 2021 19:05:13 +0100 (CET)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Matthew Wilcox <willy@...radead.org>
cc: cgel.zte@...il.com, akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, chiminghao <chi.minghao@....com.cn>,
Zeal Robot <zealci@....com.cn>,
Julia Lawall <julia.lawall@...6.fr>,
Michal Marek <mmarek@...e.com>
Subject: Re: [PATCH] mm: Use BUG_ON instead of if condition followed by BUG
On Thu, 25 Nov 2021, Matthew Wilcox wrote:
> 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@...il.com wrote:
> > > From: chiminghao <chi.minghao@....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.
OK
julia
>
> > > - 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.
> >
>
Powered by blists - more mailing lists