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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C051C433FE for ; Fri, 30 Sep 2022 12:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231372AbiI3MBq (ORCPT ); Fri, 30 Sep 2022 08:01:46 -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> 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