From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07EE6C433EF for ; Sat, 27 Nov 2021 18:05:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D87D6B0072; Sat, 27 Nov 2021 13:05:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4859E6B0078; Sat, 27 Nov 2021 13:05:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34DC16B007B; Sat, 27 Nov 2021 13:05:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id 272B56B0072 for ; Sat, 27 Nov 2021 13:05:26 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D305589B2C for ; Sat, 27 Nov 2021 18:05:15 +0000 (UTC) X-FDA: 78855487032.14.3BD75C7 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by imf03.hostedemail.com (Postfix) with ESMTP id 278BC30000BA for ; Sat, 27 Nov 2021 18:05:10 +0000 (UTC) IronPort-Data: =?us-ascii?q?A9a23=3AKQ4CGKIYk43WKmrUFE+Rm5QlxSXFcZb7ZxGrkP8?= =?us-ascii?q?bfHCw0T90hGYFzWsfXD+CM6mOM2SgL9kiPtznpEhQ75KAnYNqS1BcGVNFHysb8?= =?us-ascii?q?5KdbTi6Bh6tZH3KdpWroHqKXqzyU/GYRCwPZiKa9kjF3oTJ9yEmjPjRHOWkUoY?= =?us-ascii?q?oBwgqLeNaYHZ44f5cs75h6mJYqYDR7zKl4bsekeWHULOW82Ic3lYv1k62gEgHU?= =?us-ascii?q?MIeF98vlgdWifhj5DcynpSOZX4VDfnZw3DQGuG4EgMmLtsvwo1V/kuBl/ssItO?= =?us-ascii?q?snqz6f0tirrz6bVXI1CoQAvL7xEEd/UTe0Y5iXBYYQUVKjzSA2dR419xJsbSxT?= =?us-ascii?q?x0oN+vCgozxVjEGTn0gbfwZkFPACT3l2SCJ9GXZcn/o0t1vCk8sNIEV8+oxBnt?= =?us-ascii?q?BndQTJz0JKAKfisq5xbu6Tq9ngcFLBMDoJIY3vnBm0CGcA/E7R5zKX6TN45lfx?= =?us-ascii?q?jhYrsRPG+vOIs8cQTlxZR/DJRpVNT8/DJM4gffthXTldTBcgEyaqLBx4GXJygF?= =?us-ascii?q?1lr/3P7L9cdyLA8BUmEmYr2Xu7Xj0RBodMZqUz1Kt4H+lguTOtTHnVcQZE7j+/?= =?us-ascii?q?fgCqF+Owm0aThkfSlK/pdG9i1bgHdxFQ2QR/yM0oKsa71GwQ5/2WBjQnZIulnb?= =?us-ascii?q?wQPIJTLZ8sVvUjPSEpVbEQHIJUHhaZsZgssIqLQHGH2Shx7vBbQGDepXMIZ5Fy?= =?us-ascii?q?oqpkA=3D=3D?= IronPort-HdrOrdr: =?us-ascii?q?A9a23=3AeUwEzKouzd589RMvc5uyz0QaV5rYeYIsimQD?= =?us-ascii?q?101hICG9Ffbo6/xG/c5rqCMc7Qx7NU3I9urwQ5VoPkmsjKKdjbN8AV7AZnidhI?= =?us-ascii?q?LXFvAb0WKK+VSJcUPDH4hmpMJdmsNFZ+EYY2IK7/rS0U2cE9EjxdmB/rrtrerS?= =?us-ascii?q?1Ht2Vw1nApsA0y5JTiOaFU9yRA5JH94YE5Wbj/A3xAaISDAzbsO4A3kDUfKGnd?= =?us-ascii?q?HNmZ78CCRnO/ZngjP+6w9AH4SKd2n+4isj?= X-IronPort-AV: E=Sophos;i="5.87,269,1631570400"; d="scan'208";a="6546897" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2021 19:05:14 +0100 Date: Sat, 27 Nov 2021 19:05:13 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Matthew Wilcox cc: cgel.zte@gmail.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, chiminghao , Zeal Robot , Julia Lawall , Michal Marek Subject: Re: [PATCH] mm: Use BUG_ON instead of if condition followed by BUG In-Reply-To: Message-ID: References: <20211124030849.34998-1-chi.minghao@zte.com.cn> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 278BC30000BA X-Stat-Signature: d4ujyg6ed439xjwkmgoqf49od9hc15hb Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf03.hostedemail.com: domain of julia.lawall@inria.fr designates 192.134.164.83 as permitted sender) smtp.mailfrom=julia.lawall@inria.fr X-HE-Tag: 1638036310-481005 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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@gmail.com wrote: > > > From: chiminghao > > > > > > 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. > > >