mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Praghadeesh T K S <praghadeeshthevendria@gmail.com>
Cc: Boris Pismenny <borisp@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	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
Date: Fri, 30 Sep 2022 14:01:34 +0200	[thread overview]
Message-ID: <Yzbanh3V4jtgcih0@kroah.com> (raw)
In-Reply-To: <20220930114335.608894-1-praghadeeshthevendria@gmail.com>

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 <praghadeeshthevendria@gmail.com>
> ---
>  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

  reply	other threads:[~2022-09-30 12:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 11:43 Praghadeesh T K S
2022-09-30 12:01 ` Greg KH [this message]
2022-09-30 15:52 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yzbanh3V4jtgcih0@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=borisp@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=praghadeeshthevendria@gmail.com \
    --cc=praghadeeshtks@zohomail.in \
    --cc=saeedm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®