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 X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 45885C433E0 for ; Thu, 18 Mar 2021 08:15:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00F9F64F30 for ; Thu, 18 Mar 2021 08:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229649AbhCRIOx (ORCPT ); Thu, 18 Mar 2021 04:14:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:48728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbhCRIOY (ORCPT ); Thu, 18 Mar 2021 04:14:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B151664F04; Thu, 18 Mar 2021 08:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616055264; bh=lIluJSl7BAktteo3lXWTWv4jITCh1L+JcnjAe33GBvQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VXVJYN7XGEb23i1vob61kUo8podqJ+4SGupEUnRJB6eZhyMjEb/JtTaR3LNlbZftJ CHU0v0wMYugkmM5ikIO2B9GvGPSd3mLiS+bA5BxQY8CWPhelil1wwZw0hBhtwgGxAF 2ST6IJVZknpSiApaG62QZIWghoJ9ySg3R95h4xx816YT2AMluzzsU33KT/b8LuGdCC P85zdILFeRJJfNCgyIh18lVZhGcUJL/k6G/Lm4RI48VrnC4wW7wTbwOpgRBHkKqM/f 7HLtzIwfndtkjYlz6Q+EDGvpymgQh9HJ3g+X8axx5usQh6gBraHYPuiS2Lw6grICwn dsAjw7J8lMrLg== Date: Thu, 18 Mar 2021 10:14:20 +0200 From: Leon Romanovsky To: Jiapeng Chong Cc: dhowells@redhat.com, davem@davemloft.net, kuba@kernel.org, linux-afs@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rxrpc: rxkad: replace if (cond) BUG() with BUG_ON() Message-ID: References: <1615952318-4861-1-git-send-email-jiapeng.chong@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1615952318-4861-1-git-send-email-jiapeng.chong@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 17, 2021 at 11:38:38AM +0800, Jiapeng Chong wrote: > Fix the following coccicheck warnings: > > ./net/rxrpc/rxkad.c:1140:2-5: WARNING: Use BUG_ON instead of if > condition followed by BUG. > > Reported-by: Abaci Robot > Signed-off-by: Jiapeng Chong > --- > net/rxrpc/rxkad.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c > index e2e9e9b..bfa3d9a 100644 > --- a/net/rxrpc/rxkad.c > +++ b/net/rxrpc/rxkad.c > @@ -1135,9 +1135,8 @@ static void rxkad_decrypt_response(struct rxrpc_connection *conn, > ntohl(session_key->n[0]), ntohl(session_key->n[1])); > > mutex_lock(&rxkad_ci_mutex); > - if (crypto_sync_skcipher_setkey(rxkad_ci, session_key->x, > - sizeof(*session_key)) < 0) > - BUG(); > + BUG_ON(crypto_sync_skcipher_setkey(rxkad_ci, session_key->x, > + sizeof(*session_key)) < 0); It will be better to delete this BUG_ON() or find a way to ensure that it doesn't happen and delete after that. Thanks > > memcpy(&iv, session_key, sizeof(iv)); > > -- > 1.8.3.1 >