* [PATCH v2] net/mlx5: DR, Fix uninitialized var warning
@ 2022-11-10 13:47 YueHaibing
2022-11-10 14:43 ` Roi Dayan
2022-11-11 22:19 ` Saeed Mahameed
0 siblings, 2 replies; 3+ messages in thread
From: YueHaibing @ 2022-11-10 13:47 UTC (permalink / raw)
To: saeedm, leon, davem, edumazet, kuba, pabeni, kliteyn, mbloch,
erezsh, valex, roid
Cc: netdev, linux-rdma, linux-kernel, YueHaibing
Smatch warns this:
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c:81
mlx5dr_table_set_miss_action() error: uninitialized symbol 'ret'.
Initializing ret with -EOPNOTSUPP and fix missing action case.
Fixes: 7838e1725394 ("net/mlx5: DR, Expose steering table functionality")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: init ret to -EOPNOTSUPP
---
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
index eb81759244d5..7cc4cb7fa392 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
@@ -46,7 +46,7 @@ static int dr_table_set_miss_action_nic(struct mlx5dr_domain *dmn,
int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
struct mlx5dr_action *action)
{
- int ret;
+ int ret = -EOPNOTSUPP;
if (action && action->action_type != DR_ACTION_TYP_FT)
return -EOPNOTSUPP;
@@ -67,6 +67,9 @@ int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
goto out;
}
+ if (ret)
+ goto out;
+
/* Release old action */
if (tbl->miss_action)
refcount_dec(&tbl->miss_action->refcount);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net/mlx5: DR, Fix uninitialized var warning
2022-11-10 13:47 [PATCH v2] net/mlx5: DR, Fix uninitialized var warning YueHaibing
@ 2022-11-10 14:43 ` Roi Dayan
2022-11-11 22:19 ` Saeed Mahameed
1 sibling, 0 replies; 3+ messages in thread
From: Roi Dayan @ 2022-11-10 14:43 UTC (permalink / raw)
To: YueHaibing, saeedm, leon, davem, edumazet, kuba, pabeni, kliteyn,
mbloch, erezsh, valex
Cc: netdev, linux-rdma, linux-kernel
On 10/11/2022 15:47, YueHaibing wrote:
> Smatch warns this:
>
> drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c:81
> mlx5dr_table_set_miss_action() error: uninitialized symbol 'ret'.
>
> Initializing ret with -EOPNOTSUPP and fix missing action case.
>
> Fixes: 7838e1725394 ("net/mlx5: DR, Expose steering table functionality")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v2: init ret to -EOPNOTSUPP
> ---
> drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
> index eb81759244d5..7cc4cb7fa392 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
> @@ -46,7 +46,7 @@ static int dr_table_set_miss_action_nic(struct mlx5dr_domain *dmn,
> int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
> struct mlx5dr_action *action)
> {
> - int ret;
> + int ret = -EOPNOTSUPP;
>
> if (action && action->action_type != DR_ACTION_TYP_FT)
> return -EOPNOTSUPP;
> @@ -67,6 +67,9 @@ int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
> goto out;
> }
>
> + if (ret)
> + goto out;
> +
> /* Release old action */
> if (tbl->miss_action)
> refcount_dec(&tbl->miss_action->refcount);
thanks
Reviewed-by: Roi Dayan <roid@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net/mlx5: DR, Fix uninitialized var warning
2022-11-10 13:47 [PATCH v2] net/mlx5: DR, Fix uninitialized var warning YueHaibing
2022-11-10 14:43 ` Roi Dayan
@ 2022-11-11 22:19 ` Saeed Mahameed
1 sibling, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2022-11-11 22:19 UTC (permalink / raw)
To: YueHaibing
Cc: saeedm, leon, davem, edumazet, kuba, pabeni, kliteyn, mbloch,
erezsh, valex, roid, netdev, linux-rdma, linux-kernel
On 10 Nov 21:47, YueHaibing wrote:
>Smatch warns this:
>
>drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c:81
> mlx5dr_table_set_miss_action() error: uninitialized symbol 'ret'.
>
>Initializing ret with -EOPNOTSUPP and fix missing action case.
>
>Fixes: 7838e1725394 ("net/mlx5: DR, Expose steering table functionality")
applied to net-mlx5,
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-11 22:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-10 13:47 [PATCH v2] net/mlx5: DR, Fix uninitialized var warning YueHaibing
2022-11-10 14:43 ` Roi Dayan
2022-11-11 22:19 ` Saeed Mahameed
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox