Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3561115rwb; Fri, 30 Sep 2022 05:27:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM759REzPStD14k4tduPJzov5rR9U03iJHzggMeG+E+a7fYsmDue+zeS7Kzw8PeN+N50OGBQ X-Received: by 2002:a05:6402:142:b0:458:5d74:f4f4 with SMTP id s2-20020a056402014200b004585d74f4f4mr4455648edu.44.1664540875067; Fri, 30 Sep 2022 05:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664540875; cv=none; d=google.com; s=arc-20160816; b=C+SOiSzn6Hi5Rg21PPbbUBVV/1JV1DKsJ/HeoAP4W/wkN7qldrCSiAFz/wPuyVOW0l kVUr9Q2wc/qKYOgpmytRnYkIns3fL2ghgnNYynHzoKXN8XZC/75NuOV9mK0WY6OWF0gU 06sfHrmaK2qb96+RcVSzti2iuq3p8X9SG4Jx1zAaBF/Bhu2S3Hn7NS/gZj7qJfR6G2Yy HwAoxyTuHZyz6osDu5aHNsf4xQK/cKWP5i62sszQIWjNLq2xxJpCFCHOhVOUhf/xebvt aAVZzDThP7+v3AFru12jolonnTTQiDktmuIXx4/sYVPa5BlWnNXl+UpAMcoO9lckKr4I 01vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ul4mYj5C0kPDMbkm51HcL2q5XgWiI3daV+ZnlQxrXTs=; b=ILfmIv3uQh8JBSChYp4/3hdS8prrVR/iTIojZlPhp/6irv7C8tygRX22/KCON7hvpD oWiGLHoAjKwMRvkjCWwXMsgporgzD1r5vYnJ4zT9CNponAZdgTlr4FOwJHOtYB1Hu4uO bX78Eb+lsHzUtkPmHQDL5/b0cV3+mDOaZtFpCWESA6KSVj8rP7IM7eYERaizARCSgPcR Bzjjuvms0pWR6BzTafoN7LxxJTxAUyZPy70EcR0uW03H8AHLJoPQJVBtV35/0rEYiLHE 2n/vUDvcIxEbndnVV6ydvhcrY9B4uDCpn4ZQadDPzdf6k0c03V5uN+rZHtz/ucIggd+Y I/Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TEpa35aP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc6-20020a170907168600b00781b5f92182si1869358ejc.38.2022.09.30.05.27.15; Fri, 30 Sep 2022 05:27:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TEpa35aP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231420AbiI3MBp (ORCPT + 99 others); Fri, 30 Sep 2022 08:01:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbiI3MBn (ORCPT ); Fri, 30 Sep 2022 08:01:43 -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 5FACF177780; Fri, 30 Sep 2022 05:01:38 -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 F36EC62305; Fri, 30 Sep 2022 12:01:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDDA8C433C1; Fri, 30 Sep 2022 12:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664539297; bh=WZzX794V9cagudvFHu1WJf2NrlOx/oVKtEOLe82Lt50=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TEpa35aPjU1X8g041BdEMvwePCqUTcnpTx0QkQ7wkBLP9onCYsKJ3NRpzsr36mrnt EVWUip9v4DqWjRTz79FzpJKdp3iikzn1alAO5MtcsxKunJAYGP55jkEAGEFuzbf7Z2 PmFtMZX5H8rB5O6ivd9eQ74YMjehU5OQEYoEOcEA= Date: Fri, 30 Sep 2022 14:01:34 +0200 From: Greg KH To: Praghadeesh T K S Cc: Boris Pismenny , Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, praghadeeshtks@zohomail.in, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [PATCH] net: ethernet/mellanox: fix dereference before null check Message-ID: References: <20220930114335.608894-1-praghadeeshthevendria@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220930114335.608894-1-praghadeeshthevendria@gmail.com> X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 30, 2022 at 05:13:35PM +0530, Praghadeesh T K S wrote: > net: ethernet/mellanox: fix dereference before null check > macsec dereferenced before null check > bug identified by coverity's linux-next weekly scan > Coverity CID No: 1525317 > > Signed-off-by: Praghadeesh T K S > --- > drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c > index 5da746d..e822c2a 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c > @@ -1846,11 +1846,11 @@ int mlx5e_macsec_init(struct mlx5e_priv *priv) > void mlx5e_macsec_cleanup(struct mlx5e_priv *priv) > { > struct mlx5e_macsec *macsec = priv->macsec; > - struct mlx5_core_dev *mdev = macsec->mdev; > > if (!macsec) > return; > > + struct mlx5_core_dev *mdev = macsec->mdev; > mlx5_notifier_unregister(mdev, &macsec->nb); > > mlx5e_macsec_fs_cleanup(macsec->macsec_fs); Always test-build your changes before you get a grumpy maintainer asking why you didn't test-build your changes... Also, the original code is just fine, Coverity is wrong here, don't you think? Look at the output of what the code is doing please... thanks, greg k-h