From patchwork Wed Mar 17 06:34:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiapeng Chong X-Patchwork-Id: 12144915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EA48C4332D for ; Wed, 17 Mar 2021 06:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25BC464FA8 for ; Wed, 17 Mar 2021 06:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbhCQGfQ (ORCPT ); Wed, 17 Mar 2021 02:35:16 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:51377 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230123AbhCQGfG (ORCPT ); Wed, 17 Mar 2021 02:35:06 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R541e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0USEL4Xl_1615962899; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0USEL4Xl_1615962899) by smtp.aliyun-inc.com(127.0.0.1); Wed, 17 Mar 2021 14:35:04 +0800 From: Jiapeng Chong To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong Subject: [PATCH] attr: replace if (cond) BUG() with BUG_ON() Date: Wed, 17 Mar 2021 14:34:59 +0800 Message-Id: <1615962899-77049-1-git-send-email-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Fix the following coccicheck warnings: ./fs/attr.c:349:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- fs/attr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index 87ef39d..43f369e 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -344,9 +344,7 @@ int notify_change(struct user_namespace *mnt_userns, struct dentry *dentry, * no function will ever call notify_change with both ATTR_MODE and * ATTR_KILL_S*ID set. */ - if ((ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID)) && - (ia_valid & ATTR_MODE)) - BUG(); + BUG_ON((ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID)) && (ia_valid & ATTR_MODE)); if (ia_valid & ATTR_KILL_SUID) { if (mode & S_ISUID) {