* [PATCH net-next] net/mlx5: Fix an IS_ERR() vs NULL bug in esw_qos_move_node()
@ 2025-07-15 23:01 Dan Carpenter
2025-07-16 6:25 ` Tariq Toukan
2025-07-18 2:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-07-15 23:01 UTC (permalink / raw)
To: Carolina Jubran
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Cosmin Ratiu, netdev, linux-rdma, linux-kernel,
kernel-janitors
The __esw_qos_alloc_node() function returns NULL on error. It doesn't
return error pointers. Update the error checking to match.
Fixes: 96619c485fa6 ("net/mlx5: Add support for setting tc-bw on nodes")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
index e1cef8dd3b4d..91d863c8c152 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
@@ -1405,9 +1405,10 @@ esw_qos_move_node(struct mlx5_esw_sched_node *curr_node)
new_node = __esw_qos_alloc_node(curr_node->esw, curr_node->ix,
curr_node->type, NULL);
- if (!IS_ERR(new_node))
- esw_qos_nodes_set_parent(&curr_node->children, new_node);
+ if (!new_node)
+ return ERR_PTR(-ENOMEM);
+ esw_qos_nodes_set_parent(&curr_node->children, new_node);
return new_node;
}
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net/mlx5: Fix an IS_ERR() vs NULL bug in esw_qos_move_node()
2025-07-15 23:01 [PATCH net-next] net/mlx5: Fix an IS_ERR() vs NULL bug in esw_qos_move_node() Dan Carpenter
@ 2025-07-16 6:25 ` Tariq Toukan
2025-07-18 2:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Tariq Toukan @ 2025-07-16 6:25 UTC (permalink / raw)
To: Dan Carpenter, Carolina Jubran
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Cosmin Ratiu, netdev, linux-rdma, linux-kernel,
kernel-janitors
On 16/07/2025 2:01, Dan Carpenter wrote:
> The __esw_qos_alloc_node() function returns NULL on error. It doesn't
> return error pointers. Update the error checking to match.
>
> Fixes: 96619c485fa6 ("net/mlx5: Add support for setting tc-bw on nodes")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
> index e1cef8dd3b4d..91d863c8c152 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
> @@ -1405,9 +1405,10 @@ esw_qos_move_node(struct mlx5_esw_sched_node *curr_node)
>
> new_node = __esw_qos_alloc_node(curr_node->esw, curr_node->ix,
> curr_node->type, NULL);
> - if (!IS_ERR(new_node))
> - esw_qos_nodes_set_parent(&curr_node->children, new_node);
> + if (!new_node)
> + return ERR_PTR(-ENOMEM);
>
> + esw_qos_nodes_set_parent(&curr_node->children, new_node);
> return new_node;
> }
>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net/mlx5: Fix an IS_ERR() vs NULL bug in esw_qos_move_node()
2025-07-15 23:01 [PATCH net-next] net/mlx5: Fix an IS_ERR() vs NULL bug in esw_qos_move_node() Dan Carpenter
2025-07-16 6:25 ` Tariq Toukan
@ 2025-07-18 2:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-18 2:00 UTC (permalink / raw)
To: Dan Carpenter
Cc: cjubran, saeedm, leon, tariqt, mbloch, andrew+netdev, davem,
edumazet, kuba, pabeni, cratiu, netdev, linux-rdma, linux-kernel,
kernel-janitors
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 15 Jul 2025 18:01:30 -0500 you wrote:
> The __esw_qos_alloc_node() function returns NULL on error. It doesn't
> return error pointers. Update the error checking to match.
>
> Fixes: 96619c485fa6 ("net/mlx5: Add support for setting tc-bw on nodes")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Here is the summary with links:
- [net-next] net/mlx5: Fix an IS_ERR() vs NULL bug in esw_qos_move_node()
https://git.kernel.org/netdev/net-next/c/49be1e245ea3
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:[~2025-07-18 2:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-15 23:01 [PATCH net-next] net/mlx5: Fix an IS_ERR() vs NULL bug in esw_qos_move_node() Dan Carpenter
2025-07-16 6:25 ` Tariq Toukan
2025-07-18 2:00 ` 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).