* [PATCH net-next v2] net/mlx5e: Ensure macsec_rule is always initiailized in macsec_fs_{r,t}x_add_rule()
@ 2022-09-11 8:57 Nathan Chancellor
2022-09-11 10:35 ` Raed Salem
2022-09-20 9:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2022-09-11 8:57 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Nick Desaulniers, Tom Rix, Boris Pismenny, Raed Salem,
Lior Nahmanson, netdev, linux-rdma, linux-kernel, llvm, patches,
Nathan Chancellor
Clang warns:
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:539:6: error: variable 'macsec_rule' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (err)
^~~
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:598:9: note: uninitialized use occurs here
return macsec_rule;
^~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:539:2: note: remove the 'if' if its condition is always false
if (err)
^~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:523:38: note: initialize the variable 'macsec_rule' to silence this warning
union mlx5e_macsec_rule *macsec_rule;
^
= NULL
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1131:6: error: variable 'macsec_rule' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (err)
^~~
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1215:9: note: uninitialized use occurs here
return macsec_rule;
^~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1131:2: note: remove the 'if' if its condition is always false
if (err)
^~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1118:38: note: initialize the variable 'macsec_rule' to silence this warning
union mlx5e_macsec_rule *macsec_rule;
^
= NULL
2 errors generated.
If macsec_fs_{r,t}x_ft_get() fail, macsec_rule will be uninitialized.
Initialize it to NULL at the top of each function so that it cannot be
used uninitialized.
Fixes: e467b283ffd5 ("net/mlx5e: Add MACsec TX steering rules")
Fixes: 3b20949cb21b ("net/mlx5e: Add MACsec RX steering rules")
Link: https://github.com/ClangBuiltLinux/linux/issues/1706
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
v1 -> v2: https://lore.kernel.org/20220908153207.4048871-1-nathan@kernel.org/
* Don't use a label and goto, just initialize it to NULL at the top of
the functions (Raed).
Tom, I did not carry forward your reviewed-by tag, even though this is a
pretty obvious fix.
Blurb from v1:
I thought netdev was doing testing with clang so that new warnings do
not show up. Did something break or stop working since this is the
second time in two weeks that new warnings have appeared in -next?
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c
index 608fbbaa5a58..13dc628b988a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c
@@ -518,9 +518,9 @@ macsec_fs_tx_add_rule(struct mlx5e_macsec_fs *macsec_fs,
struct mlx5_pkt_reformat_params reformat_params = {};
struct mlx5e_macsec_tx *tx_fs = macsec_fs->tx_fs;
struct net_device *netdev = macsec_fs->netdev;
+ union mlx5e_macsec_rule *macsec_rule = NULL;
struct mlx5_flow_destination dest = {};
struct mlx5e_macsec_tables *tx_tables;
- union mlx5e_macsec_rule *macsec_rule;
struct mlx5e_macsec_tx_rule *tx_rule;
struct mlx5_flow_act flow_act = {};
struct mlx5_flow_handle *rule;
@@ -1112,10 +1112,10 @@ macsec_fs_rx_add_rule(struct mlx5e_macsec_fs *macsec_fs,
u8 action[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)] = {};
struct mlx5e_macsec_rx *rx_fs = macsec_fs->rx_fs;
struct net_device *netdev = macsec_fs->netdev;
+ union mlx5e_macsec_rule *macsec_rule = NULL;
struct mlx5_modify_hdr *modify_hdr = NULL;
struct mlx5_flow_destination dest = {};
struct mlx5e_macsec_tables *rx_tables;
- union mlx5e_macsec_rule *macsec_rule;
struct mlx5e_macsec_rx_rule *rx_rule;
struct mlx5_flow_act flow_act = {};
struct mlx5e_flow_table *ft_crypto;
base-commit: 169ccf0e40825d9e465863e4707d8e8546d3c3cb
--
2.37.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH net-next v2] net/mlx5e: Ensure macsec_rule is always initiailized in macsec_fs_{r,t}x_add_rule()
2022-09-11 8:57 [PATCH net-next v2] net/mlx5e: Ensure macsec_rule is always initiailized in macsec_fs_{r,t}x_add_rule() Nathan Chancellor
@ 2022-09-11 10:35 ` Raed Salem
2022-09-20 9:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Raed Salem @ 2022-09-11 10:35 UTC (permalink / raw)
To: Nathan Chancellor, Saeed Mahameed, Leon Romanovsky,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Nick Desaulniers, Tom Rix, Boris Pismenny, Lior Nahmanson,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
patches@lists.linux.dev
>-----Original Message-----
>From: Nathan Chancellor <nathan@kernel.org>
>Sent: Sunday, 11 September 2022 11:58
>To: 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>
>Cc: Nick Desaulniers <ndesaulniers@google.com>; Tom Rix
><trix@redhat.com>; Boris Pismenny <borisp@nvidia.com>; Raed Salem
><raeds@nvidia.com>; Lior Nahmanson <liorna@nvidia.com>;
>netdev@vger.kernel.org; linux-rdma@vger.kernel.org; linux-
>kernel@vger.kernel.org; llvm@lists.linux.dev; patches@lists.linux.dev;
>Nathan Chancellor <nathan@kernel.org>
>Subject: [PATCH net-next v2] net/mlx5e: Ensure macsec_rule is always
>initiailized in macsec_fs_{r,t}x_add_rule()
>
>External email: Use caution opening links or attachments
>
>
>Clang warns:
>
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:539:6:
>error: variable 'macsec_rule' is used uninitialized whenever 'if' condition is
>true [-Werror,-Wsometimes-uninitialized]
> if (err)
> ^~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:598:9:
>note: uninitialized use occurs here
> return macsec_rule;
> ^~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:539:2:
>note: remove the 'if' if its condition is always false
> if (err)
> ^~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:523:38:
>note: initialize the variable 'macsec_rule' to silence this warning
> union mlx5e_macsec_rule *macsec_rule;
> ^
> = NULL
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1131:6:
>error: variable 'macsec_rule' is used uninitialized whenever 'if' condition is
>true [-Werror,-Wsometimes-uninitialized]
> if (err)
> ^~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1215:9:
>note: uninitialized use occurs here
> return macsec_rule;
> ^~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1131:2:
>note: remove the 'if' if its condition is always false
> if (err)
> ^~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1118:38:
>note: initialize the variable 'macsec_rule' to silence this warning
> union mlx5e_macsec_rule *macsec_rule;
> ^
> = NULL
> 2 errors generated.
>
>If macsec_fs_{r,t}x_ft_get() fail, macsec_rule will be uninitialized.
>Initialize it to NULL at the top of each function so that it cannot be used
>uninitialized.
>
>Fixes: e467b283ffd5 ("net/mlx5e: Add MACsec TX steering rules")
>Fixes: 3b20949cb21b ("net/mlx5e: Add MACsec RX steering rules")
>Link: https://github.com/ClangBuiltLinux/linux/issues/1706
>Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>---
Reviewed-by: Raed Salem <raeds@nvidia.com>
>
>v1 -> v2: https://lore.kernel.org/20220908153207.4048871-1-
>nathan@kernel.org/
>
>* Don't use a label and goto, just initialize it to NULL at the top of
> the functions (Raed).
>
>Tom, I did not carry forward your reviewed-by tag, even though this is a pretty
>obvious fix.
>
>Blurb from v1:
>
>I thought netdev was doing testing with clang so that new warnings do not
>show up. Did something break or stop working since this is the second time in
>two weeks that new warnings have appeared in -next?
>
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c
>b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c
>index 608fbbaa5a58..13dc628b988a 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c
>@@ -518,9 +518,9 @@ macsec_fs_tx_add_rule(struct mlx5e_macsec_fs
>*macsec_fs,
> struct mlx5_pkt_reformat_params reformat_params = {};
> struct mlx5e_macsec_tx *tx_fs = macsec_fs->tx_fs;
> struct net_device *netdev = macsec_fs->netdev;
>+ union mlx5e_macsec_rule *macsec_rule = NULL;
> struct mlx5_flow_destination dest = {};
> struct mlx5e_macsec_tables *tx_tables;
>- union mlx5e_macsec_rule *macsec_rule;
> struct mlx5e_macsec_tx_rule *tx_rule;
> struct mlx5_flow_act flow_act = {};
> struct mlx5_flow_handle *rule;
>@@ -1112,10 +1112,10 @@ macsec_fs_rx_add_rule(struct mlx5e_macsec_fs
>*macsec_fs,
> u8 action[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)] = {};
> struct mlx5e_macsec_rx *rx_fs = macsec_fs->rx_fs;
> struct net_device *netdev = macsec_fs->netdev;
>+ union mlx5e_macsec_rule *macsec_rule = NULL;
> struct mlx5_modify_hdr *modify_hdr = NULL;
> struct mlx5_flow_destination dest = {};
> struct mlx5e_macsec_tables *rx_tables;
>- union mlx5e_macsec_rule *macsec_rule;
> struct mlx5e_macsec_rx_rule *rx_rule;
> struct mlx5_flow_act flow_act = {};
> struct mlx5e_flow_table *ft_crypto;
>
>base-commit: 169ccf0e40825d9e465863e4707d8e8546d3c3cb
>--
>2.37.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] net/mlx5e: Ensure macsec_rule is always initiailized in macsec_fs_{r,t}x_add_rule()
2022-09-11 8:57 [PATCH net-next v2] net/mlx5e: Ensure macsec_rule is always initiailized in macsec_fs_{r,t}x_add_rule() Nathan Chancellor
2022-09-11 10:35 ` Raed Salem
@ 2022-09-20 9:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-20 9:50 UTC (permalink / raw)
To: Nathan Chancellor
Cc: saeedm, leon, davem, edumazet, kuba, pabeni, ndesaulniers, trix,
borisp, raeds, liorna, netdev, linux-rdma, linux-kernel, llvm,
patches
Hello:
This patch was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:
On Sun, 11 Sep 2022 01:57:50 -0700 you wrote:
> Clang warns:
>
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:539:6: error: variable 'macsec_rule' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
> if (err)
> ^~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:598:9: note: uninitialized use occurs here
> return macsec_rule;
> ^~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:539:2: note: remove the 'if' if its condition is always false
> if (err)
> ^~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:523:38: note: initialize the variable 'macsec_rule' to silence this warning
> union mlx5e_macsec_rule *macsec_rule;
> ^
> = NULL
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1131:6: error: variable 'macsec_rule' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
> if (err)
> ^~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1215:9: note: uninitialized use occurs here
> return macsec_rule;
> ^~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1131:2: note: remove the 'if' if its condition is always false
> if (err)
> ^~~~~~~~
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c:1118:38: note: initialize the variable 'macsec_rule' to silence this warning
> union mlx5e_macsec_rule *macsec_rule;
> ^
> = NULL
> 2 errors generated.
>
> [...]
Here is the summary with links:
- [net-next,v2] net/mlx5e: Ensure macsec_rule is always initiailized in macsec_fs_{r,t}x_add_rule()
https://git.kernel.org/netdev/net-next/c/2e50e9bf328f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-20 9:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-11 8:57 [PATCH net-next v2] net/mlx5e: Ensure macsec_rule is always initiailized in macsec_fs_{r,t}x_add_rule() Nathan Chancellor
2022-09-11 10:35 ` Raed Salem
2022-09-20 9:50 ` patchwork-bot+netdevbpf
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).