linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][linux-next] net/mlx5: Bridge, fix uninitialized variable in mlx5_esw_bridge_port_changeupper()
@ 2021-08-18 15:52 Tim Gardner
  2021-08-18 16:47 ` Vlad Buslov
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Gardner @ 2021-08-18 15:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: tim.gardner, Saeed Mahameed, Leon Romanovsky, David S. Miller,
	Jakub Kicinski, Vlad Buslov, Jianbo Liu, Mark Bloch, Roi Dayan,
	Vladimir Oltean, netdev, linux-rdma

A recent change removed code that initialized the return code variable 'err'. It
is now possible for mlx5_esw_bridge_port_changeupper() to return an error code
using this uninitialized variable. Fix it by initializing to 0.

Addresses-Coverity: ("Uninitialized scalar variable (UNINIT)")

Cc: Saeed Mahameed <saeedm@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Vlad Buslov <vladbu@nvidia.com>
Cc: Jianbo Liu <jianbol@nvidia.com>
Cc: Mark Bloch <mbloch@nvidia.com>
Cc: Roi Dayan <roid@nvidia.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
index 0c38c2e319be..c6435c69b7c4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
@@ -137,7 +137,7 @@ static int mlx5_esw_bridge_port_changeupper(struct notifier_block *nb, void *ptr
 	u16 vport_num, esw_owner_vhca_id;
 	struct netlink_ext_ack *extack;
 	int ifindex = upper->ifindex;
-	int err;
+	int err = 0;
 
 	if (!netif_is_bridge_master(upper))
 		return 0;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][linux-next] net/mlx5: Bridge, fix uninitialized variable in mlx5_esw_bridge_port_changeupper()
  2021-08-18 15:52 [PATCH][linux-next] net/mlx5: Bridge, fix uninitialized variable in mlx5_esw_bridge_port_changeupper() Tim Gardner
@ 2021-08-18 16:47 ` Vlad Buslov
  2021-08-19  7:50   ` Saeed Mahameed
  0 siblings, 1 reply; 3+ messages in thread
From: Vlad Buslov @ 2021-08-18 16:47 UTC (permalink / raw)
  To: Saeed Mahameed, Tim Gardner
  Cc: linux-kernel, Leon Romanovsky, David S. Miller, Jakub Kicinski,
	Jianbo Liu, Mark Bloch, Roi Dayan, Vladimir Oltean, netdev,
	linux-rdma

On Wed 18 Aug 2021 at 18:52, Tim Gardner <tim.gardner@canonical.com> wrote:
> A recent change removed code that initialized the return code variable 'err'. It
> is now possible for mlx5_esw_bridge_port_changeupper() to return an error code
> using this uninitialized variable. Fix it by initializing to 0.
>
> Addresses-Coverity: ("Uninitialized scalar variable (UNINIT)")
>
> Cc: Saeed Mahameed <saeedm@nvidia.com>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Vlad Buslov <vladbu@nvidia.com>
> Cc: Jianbo Liu <jianbol@nvidia.com>
> Cc: Mark Bloch <mbloch@nvidia.com>
> Cc: Roi Dayan <roid@nvidia.com>
> Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
> Cc: netdev@vger.kernel.org
> Cc: linux-rdma@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---

Tim, thanks for fixing this!

Saeed, this is the second similar issue that I mentioned in my reply to
Colin. Again, I've already submitted same patch internally and this one
is as good as mine.

Reviewed-by: Vlad Buslov <vladbu@nvidia.com>

[...]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][linux-next] net/mlx5: Bridge, fix uninitialized variable in mlx5_esw_bridge_port_changeupper()
  2021-08-18 16:47 ` Vlad Buslov
@ 2021-08-19  7:50   ` Saeed Mahameed
  0 siblings, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2021-08-19  7:50 UTC (permalink / raw)
  To: tim.gardner, Vlad Buslov
  Cc: linux-rdma, davem, Roi Dayan, vladimir.oltean, Mark Bloch,
	linux-kernel, kuba, netdev, leon, Jianbo Liu

On Wed, 2021-08-18 at 19:47 +0300, Vlad Buslov wrote:
> On Wed 18 Aug 2021 at 18:52, Tim Gardner <tim.gardner@canonical.com>
> wrote:
> > A recent change removed code that initialized the return code
> > variable 'err'. It
> > is now possible for mlx5_esw_bridge_port_changeupper() to return an
> > error code
> > using this uninitialized variable. Fix it by initializing to 0.
> > 
> > Addresses-Coverity: ("Uninitialized scalar variable (UNINIT)")
> > 
> > Cc: Saeed Mahameed <saeedm@nvidia.com>
> > Cc: Leon Romanovsky <leon@kernel.org>
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: Jakub Kicinski <kuba@kernel.org>
> > Cc: Vlad Buslov <vladbu@nvidia.com>
> > Cc: Jianbo Liu <jianbol@nvidia.com>
> > Cc: Mark Bloch <mbloch@nvidia.com>
> > Cc: Roi Dayan <roid@nvidia.com>
> > Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
> > Cc: netdev@vger.kernel.org
> > Cc: linux-rdma@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org

Just wondering, do we really need 12 inline CCs for fixing a poor
coverity?

> > Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> > ---
> 
> Tim, thanks for fixing this!
> 
> Saeed, this is the second similar issue that I mentioned in my reply
> to
> Colin. Again, I've already submitted same patch internally and this
> one
> is as good as mine.

I don't mind both patches are perfect.

> 
> Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
> 
> [...]
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-19  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 15:52 [PATCH][linux-next] net/mlx5: Bridge, fix uninitialized variable in mlx5_esw_bridge_port_changeupper() Tim Gardner
2021-08-18 16:47 ` Vlad Buslov
2021-08-19  7:50   ` Saeed Mahameed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).