[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YUCYc7XkOVWS8h1F@unreal>
Date: Tue, 14 Sep 2021 15:41:23 +0300
From: Leon Romanovsky <leonro@...dia.com>
To: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Saeed Mahameed <saeedm@...dia.com>
CC: <linux-kernel@...r.kernel.org>, <linux-rdma@...r.kernel.org>,
Mark Bloch <mbloch@...dia.com>,
Naresh Kamboju <naresh.kamboju@...aro.org>,
<netdev@...r.kernel.org>, Roi Dayan <roid@...dia.com>,
Vlad Buslov <vladbu@...dia.com>
Subject: Re: [PATCH net-next] net/mlx5: Fix use of uninitialized variable in
bridge.c
On Tue, Sep 14, 2021 at 03:12:47PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@...dia.com>
>
> Rewrite the code to fix the following compilation warnings that were
> discovered once Linus enabled -Werror flag.
>
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:157:11: error:
> variable 'err' is used uninitialized whenever 'if' condition is false
> [-Werror,-Wsometimes-uninitialized]
> else if (mlx5_esw_bridge_dev_same_hw(rep, esw))
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:164:9: note:
> uninitialized use occurs here
> return err;
> ^~~
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:157:7: note:
> remove the 'if' if its condition is always true
> else if (mlx5_esw_bridge_dev_same_hw(rep, esw))
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:140:9: note:
> initialize the variable 'err' to silence this warning
> int err;
> ^
> = 0
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:262:7: error:
> variable 'err' is used uninitialized whenever switch case is taken
> [-Werror,-Wsometimes-uninitialized]
> case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:276:9: note:
> uninitialized use occurs here
> return err;
> ^~~
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:257:7: error:
> variable 'err' is used uninitialized whenever 'if' condition is false
> [-Werror,-Wsometimes-uninitialized]
> if (attr->u.brport_flags.mask & ~(BR_LEARNING |
> BR_FLOOD | BR_MCAST_FLOOD)) {
>
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:276:9: note:
> uninitialized use occurs here
> return err;
> ^~~
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:257:3: note:
> remove the 'if' if its condition is always true
> if (attr->u.brport_flags.mask & ~(BR_LEARNING |
> BR_FLOOD | BR_MCAST_FLOOD)) {
>
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:247:9: note:
> initialize the variable 'err' to silence this warning
> int err;
> ^
> = 0
> 3 errors generated.
>
> Fixes: ff9b7521468b ("net/mlx5: Bridge, support LAG")
> Reported-by: Naresh Kamboju <naresh.kamboju@...aro.org>
> Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> ---
> .../mellanox/mlx5/core/en/rep/bridge.c | 36 +++++++++++--------
> 1 file changed, 22 insertions(+), 14 deletions(-)
Vlad pointed to me that similar patch was already accepted.
https://patchwork.kernel.org/project/netdevbpf/patch/20210907212420.28529-2-saeed@kernel.org/
Can we please expedite the fix to Linus so our other branches (RDMA e.t.c)
that are based on pure -rcX from Linus will be compilation error free?
Thanks
Powered by blists - more mailing lists