Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4219825pxb; Mon, 30 Aug 2021 23:03:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymxomw8y8E4CV1vjfDIyjjL+rCta6bE0QdtNSiRu/9NEtlZZaMz/VMQdG51Ae/kWoMSXCa X-Received: by 2002:a5e:d80a:: with SMTP id l10mr6951452iok.36.1630389803630; Mon, 30 Aug 2021 23:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630389803; cv=none; d=google.com; s=arc-20160816; b=cZq28Q7uK9vwjkIRXG+rnW+2YWVO6g0Qu1xfS9IfMBxbiPFFOmXZZb2pJUz7Lzhuwn 5XREY9RWpfPz0ilk5666JZbFKOTk9iL85PNw4u8p+UO1wsPpuVoC927TAu3jngQd6Ypl D4kkC5ZhrR54SoxZLlMj2CJ6LFdw7cIwX1nG8200/xinjNxzD6pSNZOrnjnImvKikij0 0KkqtkRutCT8CIfng68bg9TSfEbGjIthc6gzOoD6VzqfgGxKK2LRjNvGet25JmyUhX7j h4bkWtgCkc9KXWSuoKxcG8BM4JKMNbviF1w4S6ZW8tBw+gVShVqLP2N8Fq/xJ8IEv0np cBhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=PVdJWAW4gV+l3crQVW3zm26y90XFf8SFud15h5boB9k=; b=rEwUqUBSy3lKqlRslkCawKzNc+OJD6+aEf17uBmYMj3S0PaOk6KScBqPvKftPQLHbB 1dRWE4NtutrkmfNLODvTOM7c1AbiOzdoESPD7xp9Lk4VMwVTlsa8fEvFkIBUBInBe5pU sBwmt+JUIM5+BwZXY2b4YIfROFvuZkaUiBG2DT8HG+g8ffrAazu55k7JWUs3td7FQPzV MRJuzfqVSMBt6GEL/KDIB9cIsPztQQ9HPglCIrRFrvzekCO3IoFEN0847xd4PvY9pM5g 5PD1W9KZwZipAmS7sd9ekjjDUAPAAKgTQWd+/lqPJ+1V5BjXpRlxTNkBlcMzNHpV3+w3 JC+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axtens.net header.s=google header.b=DUSY685M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x8si18850319iom.11.2021.08.30.23.02.51; Mon, 30 Aug 2021 23:03:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@axtens.net header.s=google header.b=DUSY685M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239606AbhHaGC3 (ORCPT + 99 others); Tue, 31 Aug 2021 02:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239537AbhHaGC2 (ORCPT ); Tue, 31 Aug 2021 02:02:28 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD394C06175F for ; Mon, 30 Aug 2021 23:01:33 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id n13-20020a17090a4e0d00b0017946980d8dso1156789pjh.5 for ; Mon, 30 Aug 2021 23:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=PVdJWAW4gV+l3crQVW3zm26y90XFf8SFud15h5boB9k=; b=DUSY685Mt6bD+78O+cuR0kSOvujYkzK0h6LdWW4l6nGhPWG+gnKZ9IdAmhm07pfq9l KmyQYhBx9Hed9oiHmzlk3uPA+qnoR/HSQD8nZFZNPmnUwv8UlrzJh2wRXHc3q9EGsgiS ovJMSv0vXjoDkHX3E43PSwfjU5Z+UGRoGP/4I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=PVdJWAW4gV+l3crQVW3zm26y90XFf8SFud15h5boB9k=; b=FXqiZoywneaqGeTQovIqUVKg/dU4NkEs/GRoR/RXq8757o983FXJ9SI1SuG6zUATL4 p7GWh6Pm3KhSSlfJ31wj6sFoKOZMNx+0l0blpvnhowgtpMGJtPq4zEbYShluMlULjkA2 HzqbxOuLAhAOVGPPYoWNq41omAHVjTfVc86nc/9H39Zy7QN8MNrekJsH9zUnqxSdyrqQ Knv/nF2nW3owFIjuX/ZtPsTK1GDrZmIkP180Jc4X4gTpqKi5PQhjrmcoCAOiSdQWlr2k Mq5exvePNRcE/NYTKhQlbBhVZ5guDw4nUM2uEwMmPw+pM+Jjn5PrKT15suZTRuzpiOYg myvQ== X-Gm-Message-State: AOAM532E52oKFwUjgu31V2zaqAR49cXHLG2XxYqG9D60uZymj4efw8RQ 4rJZe2htKou6PlR8YnliQBD+iw== X-Received: by 2002:a17:90a:168f:: with SMTP id o15mr3495765pja.158.1630389693272; Mon, 30 Aug 2021 23:01:33 -0700 (PDT) Received: from localhost ([2001:4479:e200:df00:a664:ffe7:ee94:4600]) by smtp.gmail.com with ESMTPSA id r15sm12914731pfh.45.2021.08.30.23.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 23:01:32 -0700 (PDT) From: Daniel Axtens To: CGEL , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Sandipan Das , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Zeal Robot , Jing Yangyang Subject: Re: [PATCH linux-next] power:pkeys: fix bugon.cocci warnings In-Reply-To: <20210825064228.70487-1-deng.changcheng@zte.com.cn> References: <20210825064228.70487-1-deng.changcheng@zte.com.cn> Date: Tue, 31 Aug 2021 16:01:29 +1000 Message-ID: <87lf4i6tl2.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jing, Thanks for your patch. The patch looks good, but looking at the output of `make coccicheck M=arch/powerpc MODE=report`, it looks like there might be a few other things that we might want to fix. Would it be worth trying to make the arch/powerpc directory free from coccinelle warnings in one big patch series, and then we could add coccicheck to our automatic patch testing? (see e.g. https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210825064228.70487-1-deng.changcheng@zte.com.cn/ ) For this patch, I think we should try to fix all of arch/powerpc at the same time. The check points out the following other possible uses of BUG_ON: arch/powerpc/include/asm/book3s/64/pgtable-64k.h:68:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h) arch/powerpc/platforms/cell/spufs/sched.c:908:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h) arch/powerpc/platforms/powernv/idle.c:968:3-6: WARNING: Use BUG_ON instead of if condition followed by BUG. Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h) arch/powerpc/platforms/powernv/idle.c:456:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h) Kind regards, Daniel > Use BUG_ON instead of a if condition followed by BUG. > > ./arch/powerpc/include/asm/book3s/64/pkeys.h:21:2-5:WARNING > Use BUG_ON instead of if condition followed by BUG. > ./arch/powerpc/include/asm/book3s/64/pkeys.h:14:2-5:WARNING > Use BUG_ON instead of if condition followed by BUG. > > Generated by: scripts/coccinelle/misc/bugon.cocci > > Reported-by: Zeal Robot > Signed-off-by: Jing Yangyang > --- > arch/powerpc/include/asm/book3s/64/pkeys.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/include/asm/book3s/64/pkeys.h b/arch/powerpc/include/asm/book3s/64/pkeys.h > index 5b17813..5f74f0c 100644 > --- a/arch/powerpc/include/asm/book3s/64/pkeys.h > +++ b/arch/powerpc/include/asm/book3s/64/pkeys.h > @@ -10,15 +10,13 @@ static inline u64 vmflag_to_pte_pkey_bits(u64 vm_flags) > if (!mmu_has_feature(MMU_FTR_PKEY)) > return 0x0UL; > > - if (radix_enabled()) > - BUG(); > + BUG_ON(radix_enabled()); > return hash__vmflag_to_pte_pkey_bits(vm_flags); > } > > static inline u16 pte_to_pkey_bits(u64 pteflags) > { > - if (radix_enabled()) > - BUG(); > + BUG_ON(radix_enabled()); > return hash__pte_to_pkey_bits(pteflags); > } > > -- > 1.8.3.1