* [PATCH v1 net-next] net: openvswitch: Use ERR_CAST() to return
@ 2024-08-29 9:55 Yan Zhen
2024-08-29 10:17 ` Eelco Chaudron
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yan Zhen @ 2024-08-29 9:55 UTC (permalink / raw)
To: edumazet, pshelar, davem, kuba, pabeni
Cc: netdev, dev, linux-kernel, opensource.kernel, Yan Zhen
Using ERR_CAST() is more reasonable and safer, When it is necessary
to convert the type of an error pointer and return it.
Signed-off-by: Yan Zhen <yanzhen@vivo.com>
---
net/openvswitch/flow_netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index c92bdc4dfe19..729ef582a3a8 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -2491,7 +2491,7 @@ static struct nlattr *reserve_sfa_size(struct sw_flow_actions **sfa,
acts = nla_alloc_flow_actions(new_acts_size);
if (IS_ERR(acts))
- return (void *)acts;
+ return ERR_CAST(acts);
memcpy(acts->actions, (*sfa)->actions, (*sfa)->actions_len);
acts->actions_len = (*sfa)->actions_len;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 net-next] net: openvswitch: Use ERR_CAST() to return
2024-08-29 9:55 [PATCH v1 net-next] net: openvswitch: Use ERR_CAST() to return Yan Zhen
@ 2024-08-29 10:17 ` Eelco Chaudron
2024-08-29 15:30 ` [ovs-dev] " Aaron Conole
2024-08-30 18:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Eelco Chaudron @ 2024-08-29 10:17 UTC (permalink / raw)
To: Yan Zhen
Cc: edumazet, pshelar, davem, kuba, pabeni, netdev, dev, linux-kernel,
opensource.kernel
On 29 Aug 2024, at 11:55, Yan Zhen wrote:
> Using ERR_CAST() is more reasonable and safer, When it is necessary
> to convert the type of an error pointer and return it.
>
> Signed-off-by: Yan Zhen <yanzhen@vivo.com>
> ---
> net/openvswitch/flow_netlink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
> index c92bdc4dfe19..729ef582a3a8 100644
> --- a/net/openvswitch/flow_netlink.c
> +++ b/net/openvswitch/flow_netlink.c
> @@ -2491,7 +2491,7 @@ static struct nlattr *reserve_sfa_size(struct sw_flow_actions **sfa,
>
> acts = nla_alloc_flow_actions(new_acts_size);
> if (IS_ERR(acts))
> - return (void *)acts;
> + return ERR_CAST(acts);
Change looks good to me.
Acked-by: Eelco Chaudron <echaudro@redhat.com>
> memcpy(acts->actions, (*sfa)->actions, (*sfa)->actions_len);
> acts->actions_len = (*sfa)->actions_len;
> --
> 2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ovs-dev] [PATCH v1 net-next] net: openvswitch: Use ERR_CAST() to return
2024-08-29 9:55 [PATCH v1 net-next] net: openvswitch: Use ERR_CAST() to return Yan Zhen
2024-08-29 10:17 ` Eelco Chaudron
@ 2024-08-29 15:30 ` Aaron Conole
2024-08-30 18:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Aaron Conole @ 2024-08-29 15:30 UTC (permalink / raw)
To: Yan Zhen
Cc: Eelco Chaudron, dev, opensource.kernel, netdev, linux-kernel,
edumazet, kuba, pabeni, davem
Yan Zhen <yanzhen@vivo.com> writes:
> Using ERR_CAST() is more reasonable and safer, When it is necessary
> to convert the type of an error pointer and return it.
>
> Signed-off-by: Yan Zhen <yanzhen@vivo.com>
> ---
LGTM, and seems like the only remaining place where we are open coding
the error return conversion in the OVS module (at least, where we do a
check with IS_ERR). At least, I tried to visit them all while looking
at this.
Reviewed-by: Aaron Conole <aconole@redhat.com>
> net/openvswitch/flow_netlink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
> index c92bdc4dfe19..729ef582a3a8 100644
> --- a/net/openvswitch/flow_netlink.c
> +++ b/net/openvswitch/flow_netlink.c
> @@ -2491,7 +2491,7 @@ static struct nlattr *reserve_sfa_size(struct sw_flow_actions **sfa,
>
> acts = nla_alloc_flow_actions(new_acts_size);
> if (IS_ERR(acts))
> - return (void *)acts;
> + return ERR_CAST(acts);
>
> memcpy(acts->actions, (*sfa)->actions, (*sfa)->actions_len);
> acts->actions_len = (*sfa)->actions_len;
> --
> 2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 net-next] net: openvswitch: Use ERR_CAST() to return
2024-08-29 9:55 [PATCH v1 net-next] net: openvswitch: Use ERR_CAST() to return Yan Zhen
2024-08-29 10:17 ` Eelco Chaudron
2024-08-29 15:30 ` [ovs-dev] " Aaron Conole
@ 2024-08-30 18:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-30 18:20 UTC (permalink / raw)
To: Yan Zhen
Cc: edumazet, pshelar, davem, kuba, pabeni, netdev, dev, linux-kernel,
opensource.kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 29 Aug 2024 17:55:09 +0800 you wrote:
> Using ERR_CAST() is more reasonable and safer, When it is necessary
> to convert the type of an error pointer and return it.
>
> Signed-off-by: Yan Zhen <yanzhen@vivo.com>
> ---
> net/openvswitch/flow_netlink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [v1,net-next] net: openvswitch: Use ERR_CAST() to return
https://git.kernel.org/netdev/net-next/c/b26b64493343
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] 4+ messages in thread
end of thread, other threads:[~2024-08-30 18:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29 9:55 [PATCH v1 net-next] net: openvswitch: Use ERR_CAST() to return Yan Zhen
2024-08-29 10:17 ` Eelco Chaudron
2024-08-29 15:30 ` [ovs-dev] " Aaron Conole
2024-08-30 18:20 ` 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).