All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Conole <aconole@redhat.com>
To: Yan Zhen <yanzhen@vivo.com>
Cc: Eelco Chaudron <echaudro@redhat.com>,
	dev@openvswitch.org, opensource.kernel@vivo.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	davem@davemloft.net
Subject: Re: [ovs-dev] [PATCH v1 net-next] net: openvswitch: Use ERR_CAST() to return
Date: Thu, 29 Aug 2024 11:30:27 -0400	[thread overview]
Message-ID: <f7tzfov1h4c.fsf@redhat.com> (raw)
In-Reply-To: <20240829095509.3151987-1-yanzhen@vivo.com>


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


  parent reply	other threads:[~2024-08-29 15:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-08-30 18:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7tzfov1h4c.fsf@redhat.com \
    --to=aconole@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=echaudro@redhat.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opensource.kernel@vivo.com \
    --cc=pabeni@redhat.com \
    --cc=yanzhen@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.