* [PATCH net-next] net/mlx5: Add esw assignment back in mlx5e_tc_sample_unoffload()
@ 2021-10-27 15:31 Nathan Chancellor
2021-10-28 5:29 ` Saeed Mahameed
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2021-10-27 15:31 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky, David S. Miller, Jakub Kicinski
Cc: Nick Desaulniers, netdev, linux-rdma, linux-kernel, llvm,
Nathan Chancellor
Clang warns:
drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c:635:34: error: variable 'esw' is uninitialized when used here [-Werror,-Wuninitialized]
mlx5_eswitch_del_offloaded_rule(esw, sample_flow->pre_rule, sample_flow->pre_attr);
^~~
drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c:626:26: note: initialize the variable 'esw' to silence this warning
struct mlx5_eswitch *esw;
^
= NULL
1 error generated.
It appears that the assignment should have been shuffled instead of
removed outright like in mlx5e_tc_sample_offload(). Add it back so there
is no use of esw uninitialized.
Fixes: a64c5edbd20e ("net/mlx5: Remove unnecessary checks for slow path flag")
Link: https://github.com/ClangBuiltLinux/linux/issues/1494
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c
index 1046b7ea5c88..df6888c4793c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c
@@ -631,6 +631,7 @@ mlx5e_tc_sample_unoffload(struct mlx5e_tc_psample *tc_psample,
/* The following delete order can't be changed, otherwise,
* will hit fw syndromes.
*/
+ esw = tc_psample->esw;
sample_flow = attr->sample_attr->sample_flow;
mlx5_eswitch_del_offloaded_rule(esw, sample_flow->pre_rule, sample_flow->pre_attr);
base-commit: 6487c819393ed1678ef847fd260ea86edccc0bb3
--
2.33.1.637.gf443b226ca
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net/mlx5: Add esw assignment back in mlx5e_tc_sample_unoffload()
2021-10-27 15:31 [PATCH net-next] net/mlx5: Add esw assignment back in mlx5e_tc_sample_unoffload() Nathan Chancellor
@ 2021-10-28 5:29 ` Saeed Mahameed
0 siblings, 0 replies; 2+ messages in thread
From: Saeed Mahameed @ 2021-10-28 5:29 UTC (permalink / raw)
To: Nathan Chancellor, Leon Romanovsky, David S. Miller,
Jakub Kicinski
Cc: Nick Desaulniers, netdev, linux-rdma, linux-kernel, llvm
On Wed, 2021-10-27 at 08:31 -0700, Nathan Chancellor wrote:
> Clang warns:
>
> drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c:635:34: error:
> variable 'esw' is uninitialized when used here [-Werror,-
> Wuninitialized]
> mlx5_eswitch_del_offloaded_rule(esw, sample_flow->pre_rule,
> sample_flow->pre_attr);
> ^~~
> drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c:626:26: note:
> initialize the variable 'esw' to silence this warning
> struct mlx5_eswitch *esw;
> ^
> = NULL
> 1 error generated.
>
> It appears that the assignment should have been shuffled instead of
> removed outright like in mlx5e_tc_sample_offload(). Add it back so
> there
> is no use of esw uninitialized.
>
> Fixes: a64c5edbd20e ("net/mlx5: Remove unnecessary checks for slow
> path flag")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1494
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Nice catch !
applied to net-next-mlx5,
Thanks !
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-28 5:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-27 15:31 [PATCH net-next] net/mlx5: Add esw assignment back in mlx5e_tc_sample_unoffload() Nathan Chancellor
2021-10-28 5:29 ` 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).