[PATCH] net: ethernet/mellanox: fix dereference before null check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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);
-- 
2.25.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux