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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7CC0C6FD1F for ; Sun, 19 Mar 2023 11:41:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbjCSLll (ORCPT ); Sun, 19 Mar 2023 07:41:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230227AbjCSLli (ORCPT ); Sun, 19 Mar 2023 07:41:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CE6B1CAF4; Sun, 19 Mar 2023 04:41:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 584FD60FCB; Sun, 19 Mar 2023 11:41:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AF5FC433D2; Sun, 19 Mar 2023 11:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679226095; bh=ExZwx8jh/Z19yiEgpkbK+BLckhnmEjECfuwpp5U7nW0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ha8+NoV5KMotFaVzeYbTTD0suS9RQhwThazW8291t+hgww4f0xcPfrj9jgFcFOf5v 2L7C2u1/bVqlT97R7EHX1ke2bQkA/gTuxbaw9ce9AMWEqb7cnohczlyJ9GrZIRXfqP pyJxs2ofUrBoG9XjYnSAyZVvXK943irTuZlpKGoo64viKasN/0aCS+nzz3vFaOpGfk oZIiFfawDpAoHNBPf9TodIQg9XuxGEkHu+KGPT1CXtbVE1oW4f8dq3WzoPfMrwDjQ4 H3U/+90PtAdU/D0gMVkRZkIGrnSXUmqwWXP9bbV2CoA8VqUQYGfQNrM8OwXUYZM42u 6C20zTKGgbUrw== Date: Sun, 19 Mar 2023 13:41:31 +0200 From: Leon Romanovsky To: Markus Elfring Cc: kernel-janitors@vger.kernel.org, linux-rdma@vger.kernel.org, Cheng Xu , Jason Gunthorpe , Kai Shen , Yang Li , cocci@inria.fr, LKML Subject: Re: [PATCH] RDMA/erdma: Fix exception handling in erdma_accept_newconn() Message-ID: <20230319114131.GC36557@unreal> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 18, 2023 at 09:15:58PM +0100, Markus Elfring wrote: > Date: Sat, 18 Mar 2023 21:08:58 +0100 > > The label “error” was used to jump to another pointer check despite of > the detail in the implementation of the function “erdma_accept_newconn” > that it was determined already that corresponding variables contained > still null pointers. > > 1. Thus return directly if >    * the cep state is not the value “ERDMA_EPSTATE_LISTENING” >      or >    * a call of the function “erdma_cep_alloc” failed. > > 2. Use more appropriate labels instead. > > 3. Delete two questionable checks. > > 4. Omit extra initialisations (for the variables “new_cep”, “new_s” and “ret”) >    which became unnecessary with this refactoring. > > > This issue was detected by using the Coccinelle software. > > Fixes: 920d93eac8b97778fef48f34f10e58ddf870fc2a ("RDMA/erdma: Add connection management (CM) support") > Signed-off-by: Markus Elfring > --- >  drivers/infiniband/hw/erdma/erdma_cm.c | 39 +++++++++++--------------- >  1 file changed, 17 insertions(+), 22 deletions(-) Same comment as for your RDMA/siw patch. Thanks