netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path
@ 2022-09-14 14:00 Yang Yingliang
  2022-09-14 14:01 ` [PATCH -next v2 2/2] net/mlx5e: Switch to kmemdup() when allocate dev_addr Yang Yingliang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Yang Yingliang @ 2022-09-14 14:00 UTC (permalink / raw)
  To: netdev, linux-rdma; +Cc: saeedm, liorna, raeds, davem

Add missing error code when mlx5e_macsec_fs_add_rule() or
mlx5e_macsec_fs_init() fails. mlx5e_macsec_fs_init() don't
return ERR_PTR(), so replace IS_ERR_OR_NULL() check with
NULL pointer check.

Fixes: e467b283ffd5 ("net/mlx5e: Add MACsec TX steering rules")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v2:
  Replace IS_ERR_OR_NULL() check with NULL pointer check.
---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
index d9d18b039d8c..100e03eb740b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
@@ -194,8 +194,10 @@ static int mlx5e_macsec_init_sa(struct macsec_context *ctx,
 				      MLX5_ACCEL_MACSEC_ACTION_DECRYPT;
 
 	macsec_rule = mlx5e_macsec_fs_add_rule(macsec->macsec_fs, ctx, &rule_attrs, &sa->fs_id);
-	if (IS_ERR_OR_NULL(macsec_rule))
+	if (!macsec_rule) {
+		err = -ENOMEM;
 		goto destroy_macsec_object;
+	}
 
 	sa->macsec_rule = macsec_rule;
 
@@ -1294,8 +1296,10 @@ int mlx5e_macsec_init(struct mlx5e_priv *priv)
 	macsec->mdev = mdev;
 
 	macsec_fs = mlx5e_macsec_fs_init(mdev, priv->netdev);
-	if (IS_ERR_OR_NULL(macsec_fs))
+	if (!macsec_fs) {
+		err = -ENOMEM;
 		goto err_out;
+	}
 
 	macsec->macsec_fs = macsec_fs;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH -next v2 2/2] net/mlx5e: Switch to kmemdup() when allocate dev_addr
  2022-09-14 14:00 [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path Yang Yingliang
@ 2022-09-14 14:01 ` Yang Yingliang
  2022-09-14 20:10   ` Saeed Mahameed
  2022-09-14 20:10 ` [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path Saeed Mahameed
  2022-09-20  1:10 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Yang Yingliang @ 2022-09-14 14:01 UTC (permalink / raw)
  To: netdev, linux-rdma; +Cc: saeedm, liorna, raeds, davem

Use kmemdup() helper instead of open-coding to
simplify the code when allocate dev_addr.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v2:
 Make kmemdup() fit in one line.
---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
index 100e03eb740b..ea362072a984 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
@@ -931,14 +931,13 @@ static int mlx5e_macsec_add_secy(struct macsec_context *ctx)
 		goto out;
 	}
 
-	macsec_device->dev_addr = kzalloc(dev->addr_len, GFP_KERNEL);
+	macsec_device->dev_addr = kmemdup(dev->dev_addr, dev->addr_len, GFP_KERNEL);
 	if (!macsec_device->dev_addr) {
 		kfree(macsec_device);
 		err = -ENOMEM;
 		goto out;
 	}
 
-	memcpy(macsec_device->dev_addr, dev->dev_addr, dev->addr_len);
 	macsec_device->netdev = dev;
 
 	INIT_LIST_HEAD_RCU(&macsec_device->macsec_rx_sc_list_head);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path
  2022-09-14 14:00 [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path Yang Yingliang
  2022-09-14 14:01 ` [PATCH -next v2 2/2] net/mlx5e: Switch to kmemdup() when allocate dev_addr Yang Yingliang
@ 2022-09-14 20:10 ` Saeed Mahameed
  2022-09-20  1:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Saeed Mahameed @ 2022-09-14 20:10 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: netdev, linux-rdma, liorna, raeds, davem

On 14 Sep 22:00, Yang Yingliang wrote:
>Add missing error code when mlx5e_macsec_fs_add_rule() or
>mlx5e_macsec_fs_init() fails. mlx5e_macsec_fs_init() don't
>return ERR_PTR(), so replace IS_ERR_OR_NULL() check with
>NULL pointer check.
>
>Fixes: e467b283ffd5 ("net/mlx5e: Add MACsec TX steering rules")
>Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>---
>v2:
>  Replace IS_ERR_OR_NULL() check with NULL pointer check.
>---

Acked-by: Saeed Mahameed <saeedm@nvidia.com>

netdev maintainers please apply directly.

Thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next v2 2/2] net/mlx5e: Switch to kmemdup() when allocate dev_addr
  2022-09-14 14:01 ` [PATCH -next v2 2/2] net/mlx5e: Switch to kmemdup() when allocate dev_addr Yang Yingliang
@ 2022-09-14 20:10   ` Saeed Mahameed
  0 siblings, 0 replies; 5+ messages in thread
From: Saeed Mahameed @ 2022-09-14 20:10 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: netdev, linux-rdma, liorna, raeds, davem

On 14 Sep 22:01, Yang Yingliang wrote:
>Use kmemdup() helper instead of open-coding to
>simplify the code when allocate dev_addr.
>
>Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>---
>v2:
> Make kmemdup() fit in one line.
>---

Acked-by: Saeed Mahameed <saeedm@nvidia.com>                                    
                                                                                 
netdev maintainers please apply directly.                                       
                                                                                 
Thanks.                                                                         
            

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path
  2022-09-14 14:00 [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path Yang Yingliang
  2022-09-14 14:01 ` [PATCH -next v2 2/2] net/mlx5e: Switch to kmemdup() when allocate dev_addr Yang Yingliang
  2022-09-14 20:10 ` [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path Saeed Mahameed
@ 2022-09-20  1:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-20  1:10 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: netdev, linux-rdma, saeedm, liorna, raeds, davem

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 14 Sep 2022 22:00:59 +0800 you wrote:
> Add missing error code when mlx5e_macsec_fs_add_rule() or
> mlx5e_macsec_fs_init() fails. mlx5e_macsec_fs_init() don't
> return ERR_PTR(), so replace IS_ERR_OR_NULL() check with
> NULL pointer check.
> 
> Fixes: e467b283ffd5 ("net/mlx5e: Add MACsec TX steering rules")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> 
> [...]

Here is the summary with links:
  - [-next,v2,1/2] net/mlx5e: add missing error code in error path
    https://git.kernel.org/netdev/net-next/c/46ff47bc81b4
  - [-next,v2,2/2] net/mlx5e: Switch to kmemdup() when allocate dev_addr
    https://git.kernel.org/netdev/net-next/c/13c76227cd8a

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] 5+ messages in thread

end of thread, other threads:[~2022-09-20  1:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 14:00 [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path Yang Yingliang
2022-09-14 14:01 ` [PATCH -next v2 2/2] net/mlx5e: Switch to kmemdup() when allocate dev_addr Yang Yingliang
2022-09-14 20:10   ` Saeed Mahameed
2022-09-14 20:10 ` [PATCH -next v2 1/2] net/mlx5e: add missing error code in error path Saeed Mahameed
2022-09-20  1:10 ` 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).