netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: xiangxia.m.yue@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] skbuff: Add BUG_ON in skb_init.
Date: Wed, 09 Aug 2017 22:49:39 -0700 (PDT)	[thread overview]
Message-ID: <20170809.224939.550080421760909361.davem@davemloft.net> (raw)
In-Reply-To: <1502280278-9970-2-git-send-email-xiangxia.m.yue@gmail.com>

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Wed,  9 Aug 2017 05:04:38 -0700

> When initializing the skbuff SLAB cache, we should make
> sure it is successful. Adding BUG_ON to check it and
> init_inodecache() is in the same case.
> 
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
>  net/core/skbuff.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 42b62c716a33..9513de519870 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -3904,6 +3904,8 @@ void __init skb_init(void)
>  						0,
>  						SLAB_HWCACHE_ALIGN|SLAB_PANIC,
>  						NULL);
> +	BUG_ON(skbuff_head_cache == NULL);
> +	BUG_ON(skbuff_fclone_cache == NULL);
>  }

I know you guys want every allocation to be explicitly checked so that
everything is consistent for static code analysis checkers.

But this is just wasted code.

The first allocation will take a NULL dereference and the backtrace
will make it completely clear which SLAB cache was NULL and couldn't
be allocated.

So there is no real value to adding these checks.

So I'm not applying this, sorry.

The same logic goes for your other patch of this nature.

  reply	other threads:[~2017-08-10  5:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 12:04 [PATCH net-next] net: skb_needs_check() removes CHECKSUM_NONE check for tx Tonghao Zhang
2017-08-09 12:04 ` [PATCH net-next] skbuff: Add BUG_ON in skb_init Tonghao Zhang
2017-08-10  5:49   ` David Miller [this message]
2017-08-10  6:10     ` Tonghao Zhang
2017-08-10  6:41       ` Yuan, Linyu (NSB - CN/Shanghai)
2017-08-09 18:30 ` [PATCH net-next] net: skb_needs_check() removes CHECKSUM_NONE check for tx Willem de Bruijn
2017-08-10  1:02   ` Tonghao Zhang
2017-08-10 17:03     ` Willem de Bruijn
2017-08-11  2:29       ` Tonghao Zhang

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=20170809.224939.550080421760909361.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=xiangxia.m.yue@gmail.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 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).