All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Vlad Yasevich <vyasevich@gmail.com>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next] net: Drop unlikely before IS_ERR(_OR_NULL)
Date: Wed, 5 Jun 2019 12:40:00 -0400	[thread overview]
Message-ID: <20190605164000.GB554@hmswarspite.think-freely.org> (raw)
In-Reply-To: <20190605142428.84784-3-wangkefeng.wang@huawei.com>

On Wed, Jun 05, 2019 at 10:24:26PM +0800, Kefeng Wang wrote:
> IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag,
> so no need to do that again from its callers. Drop it.
> 
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
> Cc: Vlad Yasevich <vyasevich@gmail.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Cc: netdev@vger.kernel.org
> Cc: linux-sctp@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/net/udp.h           | 2 +-
>  net/ipv4/fib_semantics.c    | 2 +-
>  net/ipv4/inet_hashtables.c  | 2 +-
>  net/ipv4/udp.c              | 2 +-
>  net/ipv4/udp_offload.c      | 2 +-
>  net/ipv6/inet6_hashtables.c | 2 +-
>  net/ipv6/udp.c              | 2 +-
>  net/sctp/socket.c           | 4 ++--
>  8 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/include/net/udp.h b/include/net/udp.h
> index 79d141d2103b..bad74f780831 100644
> --- a/include/net/udp.h
> +++ b/include/net/udp.h
> @@ -480,7 +480,7 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
>  	 * CB fragment
>  	 */
>  	segs = __skb_gso_segment(skb, features, false);
> -	if (unlikely(IS_ERR_OR_NULL(segs))) {
> +	if (IS_ERR_OR_NULL(segs)) {
>  		int segs_nr = skb_shinfo(skb)->gso_segs;
>  
>  		atomic_add(segs_nr, &sk->sk_drops);
> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
> index b80410673915..cd35bd0a4d8a 100644
> --- a/net/ipv4/fib_semantics.c
> +++ b/net/ipv4/fib_semantics.c
> @@ -1295,7 +1295,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg,
>  		goto failure;
>  	fi->fib_metrics = ip_fib_metrics_init(fi->fib_net, cfg->fc_mx,
>  					      cfg->fc_mx_len, extack);
> -	if (unlikely(IS_ERR(fi->fib_metrics))) {
> +	if (IS_ERR(fi->fib_metrics)) {
>  		err = PTR_ERR(fi->fib_metrics);
>  		kfree(fi);
>  		return ERR_PTR(err);
> diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
> index c4503073248b..97824864e40d 100644
> --- a/net/ipv4/inet_hashtables.c
> +++ b/net/ipv4/inet_hashtables.c
> @@ -316,7 +316,7 @@ struct sock *__inet_lookup_listener(struct net *net,
>  				    saddr, sport, htonl(INADDR_ANY), hnum,
>  				    dif, sdif);
>  done:
> -	if (unlikely(IS_ERR(result)))
> +	if (IS_ERR(result))
>  		return NULL;
>  	return result;
>  }
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 189144346cd4..8983afe2fe9e 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -478,7 +478,7 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
>  					  htonl(INADDR_ANY), hnum, dif, sdif,
>  					  exact_dif, hslot2, skb);
>  	}
> -	if (unlikely(IS_ERR(result)))
> +	if (IS_ERR(result))
>  		return NULL;
>  	return result;
>  }
> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
> index 06b3e2c1fcdc..0112f64faf69 100644
> --- a/net/ipv4/udp_offload.c
> +++ b/net/ipv4/udp_offload.c
> @@ -208,7 +208,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
>  		gso_skb->destructor = NULL;
>  
>  	segs = skb_segment(gso_skb, features);
> -	if (unlikely(IS_ERR_OR_NULL(segs))) {
> +	if (IS_ERR_OR_NULL(segs)) {
>  		if (copy_dtor)
>  			gso_skb->destructor = sock_wfree;
>  		return segs;
> diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
> index b2a55f300318..cf60fae9533b 100644
> --- a/net/ipv6/inet6_hashtables.c
> +++ b/net/ipv6/inet6_hashtables.c
> @@ -174,7 +174,7 @@ struct sock *inet6_lookup_listener(struct net *net,
>  				     saddr, sport, &in6addr_any, hnum,
>  				     dif, sdif);
>  done:
> -	if (unlikely(IS_ERR(result)))
> +	if (IS_ERR(result))
>  		return NULL;
>  	return result;
>  }
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index b3418a7c5c74..693518350f79 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -215,7 +215,7 @@ struct sock *__udp6_lib_lookup(struct net *net,
>  					  exact_dif, hslot2,
>  					  skb);
>  	}
> -	if (unlikely(IS_ERR(result)))
> +	if (IS_ERR(result))
>  		return NULL;
>  	return result;
>  }
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 39ea0a37af09..c7b0f51c19d5 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -985,7 +985,7 @@ static int sctp_setsockopt_bindx(struct sock *sk,
>  		return -EINVAL;
>  
>  	kaddrs = memdup_user(addrs, addrs_size);
> -	if (unlikely(IS_ERR(kaddrs)))
> +	if (IS_ERR(kaddrs))
>  		return PTR_ERR(kaddrs);
>  
>  	/* Walk through the addrs buffer and count the number of addresses. */
> @@ -1315,7 +1315,7 @@ static int __sctp_setsockopt_connectx(struct sock *sk,
>  		return -EINVAL;
>  
>  	kaddrs = memdup_user(addrs, addrs_size);
> -	if (unlikely(IS_ERR(kaddrs)))
> +	if (IS_ERR(kaddrs))
>  		return PTR_ERR(kaddrs);
>  
>  	/* Allow security module to validate connectx addresses. */
> -- 
> 2.20.1
> 
> 
for the SCTP bits
Acked-by: Neil Horman <nhorman@tuxdriver.com>


WARNING: multiple messages have this Message-ID (diff)
From: Neil Horman <nhorman@tuxdriver.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Vlad Yasevich <vyasevich@gmail.com>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next] net: Drop unlikely before IS_ERR(_OR_NULL)
Date: Wed, 05 Jun 2019 16:40:00 +0000	[thread overview]
Message-ID: <20190605164000.GB554@hmswarspite.think-freely.org> (raw)
In-Reply-To: <20190605142428.84784-3-wangkefeng.wang@huawei.com>

On Wed, Jun 05, 2019 at 10:24:26PM +0800, Kefeng Wang wrote:
> IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag,
> so no need to do that again from its callers. Drop it.
> 
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
> Cc: Vlad Yasevich <vyasevich@gmail.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Cc: netdev@vger.kernel.org
> Cc: linux-sctp@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/net/udp.h           | 2 +-
>  net/ipv4/fib_semantics.c    | 2 +-
>  net/ipv4/inet_hashtables.c  | 2 +-
>  net/ipv4/udp.c              | 2 +-
>  net/ipv4/udp_offload.c      | 2 +-
>  net/ipv6/inet6_hashtables.c | 2 +-
>  net/ipv6/udp.c              | 2 +-
>  net/sctp/socket.c           | 4 ++--
>  8 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/include/net/udp.h b/include/net/udp.h
> index 79d141d2103b..bad74f780831 100644
> --- a/include/net/udp.h
> +++ b/include/net/udp.h
> @@ -480,7 +480,7 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
>  	 * CB fragment
>  	 */
>  	segs = __skb_gso_segment(skb, features, false);
> -	if (unlikely(IS_ERR_OR_NULL(segs))) {
> +	if (IS_ERR_OR_NULL(segs)) {
>  		int segs_nr = skb_shinfo(skb)->gso_segs;
>  
>  		atomic_add(segs_nr, &sk->sk_drops);
> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
> index b80410673915..cd35bd0a4d8a 100644
> --- a/net/ipv4/fib_semantics.c
> +++ b/net/ipv4/fib_semantics.c
> @@ -1295,7 +1295,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg,
>  		goto failure;
>  	fi->fib_metrics = ip_fib_metrics_init(fi->fib_net, cfg->fc_mx,
>  					      cfg->fc_mx_len, extack);
> -	if (unlikely(IS_ERR(fi->fib_metrics))) {
> +	if (IS_ERR(fi->fib_metrics)) {
>  		err = PTR_ERR(fi->fib_metrics);
>  		kfree(fi);
>  		return ERR_PTR(err);
> diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
> index c4503073248b..97824864e40d 100644
> --- a/net/ipv4/inet_hashtables.c
> +++ b/net/ipv4/inet_hashtables.c
> @@ -316,7 +316,7 @@ struct sock *__inet_lookup_listener(struct net *net,
>  				    saddr, sport, htonl(INADDR_ANY), hnum,
>  				    dif, sdif);
>  done:
> -	if (unlikely(IS_ERR(result)))
> +	if (IS_ERR(result))
>  		return NULL;
>  	return result;
>  }
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 189144346cd4..8983afe2fe9e 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -478,7 +478,7 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
>  					  htonl(INADDR_ANY), hnum, dif, sdif,
>  					  exact_dif, hslot2, skb);
>  	}
> -	if (unlikely(IS_ERR(result)))
> +	if (IS_ERR(result))
>  		return NULL;
>  	return result;
>  }
> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
> index 06b3e2c1fcdc..0112f64faf69 100644
> --- a/net/ipv4/udp_offload.c
> +++ b/net/ipv4/udp_offload.c
> @@ -208,7 +208,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
>  		gso_skb->destructor = NULL;
>  
>  	segs = skb_segment(gso_skb, features);
> -	if (unlikely(IS_ERR_OR_NULL(segs))) {
> +	if (IS_ERR_OR_NULL(segs)) {
>  		if (copy_dtor)
>  			gso_skb->destructor = sock_wfree;
>  		return segs;
> diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
> index b2a55f300318..cf60fae9533b 100644
> --- a/net/ipv6/inet6_hashtables.c
> +++ b/net/ipv6/inet6_hashtables.c
> @@ -174,7 +174,7 @@ struct sock *inet6_lookup_listener(struct net *net,
>  				     saddr, sport, &in6addr_any, hnum,
>  				     dif, sdif);
>  done:
> -	if (unlikely(IS_ERR(result)))
> +	if (IS_ERR(result))
>  		return NULL;
>  	return result;
>  }
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index b3418a7c5c74..693518350f79 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -215,7 +215,7 @@ struct sock *__udp6_lib_lookup(struct net *net,
>  					  exact_dif, hslot2,
>  					  skb);
>  	}
> -	if (unlikely(IS_ERR(result)))
> +	if (IS_ERR(result))
>  		return NULL;
>  	return result;
>  }
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 39ea0a37af09..c7b0f51c19d5 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -985,7 +985,7 @@ static int sctp_setsockopt_bindx(struct sock *sk,
>  		return -EINVAL;
>  
>  	kaddrs = memdup_user(addrs, addrs_size);
> -	if (unlikely(IS_ERR(kaddrs)))
> +	if (IS_ERR(kaddrs))
>  		return PTR_ERR(kaddrs);
>  
>  	/* Walk through the addrs buffer and count the number of addresses. */
> @@ -1315,7 +1315,7 @@ static int __sctp_setsockopt_connectx(struct sock *sk,
>  		return -EINVAL;
>  
>  	kaddrs = memdup_user(addrs, addrs_size);
> -	if (unlikely(IS_ERR(kaddrs)))
> +	if (IS_ERR(kaddrs))
>  		return PTR_ERR(kaddrs);
>  
>  	/* Allow security module to validate connectx addresses. */
> -- 
> 2.20.1
> 
> 
for the SCTP bits
Acked-by: Neil Horman <nhorman@tuxdriver.com>

  parent reply	other threads:[~2019-06-05 16:40 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05 14:24 [PATCH] fs: gfs2: Use IS_ERR_OR_NULL Kefeng Wang
2019-06-05 14:24 ` [Cluster-devel] " Kefeng Wang
2019-06-05 14:24 ` [PATCH] fs: cifs: Drop unlikely before IS_ERR(_OR_NULL) Kefeng Wang
2019-06-05 14:24 ` [PATCH net-next] net: " Kefeng Wang
2019-06-05 14:24   ` Kefeng Wang
2019-06-05 16:13   ` Jesse Brandeburg
2019-06-05 16:13     ` Jesse Brandeburg
2019-06-06  1:39     ` Kefeng Wang
2019-06-06  1:39       ` Kefeng Wang
2019-06-06 20:41       ` Enrico Weigelt, metux IT consult
2019-06-06 20:41         ` Enrico Weigelt, metux IT consult
2019-06-05 16:40   ` Neil Horman [this message]
2019-06-05 16:40     ` Neil Horman
2019-06-05 14:24 ` [PATCH] block: " Kefeng Wang
2019-06-05 14:22   ` Jens Axboe
2019-06-05 18:24   ` Enrico Weigelt, metux IT consult
2019-06-05 18:32     ` Joe Perches
2019-06-05 20:55       ` Enrico Weigelt, metux IT consult
2019-06-05 14:24 ` [PATCH] Input: alps: " Kefeng Wang
2019-06-05 14:24   ` Kefeng Wang
2019-06-05 14:42   ` Pali Rohár
2019-06-06  1:08     ` Kefeng Wang
2019-06-06  1:08       ` Kefeng Wang
2019-06-06  2:28       ` Joe Perches
2019-06-12  0:59         ` Dmitry Torokhov
2019-06-12  7:14           ` Pali Rohár
2019-06-12  8:35             ` Joe Perches
2019-06-11 16:23 ` [PATCH] fs: gfs2: Use IS_ERR_OR_NULL Andreas Gruenbacher
2019-06-11 16:23   ` [Cluster-devel] " Andreas Gruenbacher
2019-06-12  1:07   ` Kefeng Wang
2019-06-12  1:07     ` [Cluster-devel] " Kefeng Wang
2019-06-12  1:17   ` [PATCH v2] " Kefeng Wang
2019-06-12  1:17     ` [Cluster-devel] " Kefeng Wang

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=20190605164000.GB554@hmswarspite.think-freely.org \
    --to=nhorman@tuxdriver.com \
    --cc=davem@davemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vyasevich@gmail.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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.