Subject: Re: [PATCH net-next,v2] ipv6: Add rate limit mask for ICMPv6 messages

From: Stephen Suryaputra <[email-masked]>
Date: Wed, 17 Apr 2019 14:13:40 -0400

On Wed, Apr 17, 2019 at 10:46:47AM -0700, David Miller wrote:
> From: Stephen Suryaputra <[email-masked]>
> Date: Mon, 15 Apr 2019 20:31:57 -0400
> 
> > @@ -850,6 +850,14 @@ static int __net_init inet6_net_init(struct net *net)
> >  	net->ipv6.sysctl.icmpv6_echo_ignore_all = 0;
> >  	net->ipv6.sysctl.icmpv6_echo_ignore_multicast = 0;
> >  	net->ipv6.sysctl.icmpv6_echo_ignore_anycast = 0;
> > +	net->ipv6.sysctl.icmpv6_ratemask = kzalloc(ICMPV6_MSG_MAX + 1, GFP_KERNEL);
> > +	if (net->ipv6.sysctl.icmpv6_ratemask) {
> > +		/* By default, rate limit error messages.
> > +		 * Except for pmtu discovery, it would break it.
> > +		 */
> > +		bitmap_set(net->ipv6.sysctl.icmpv6_ratemask, 0, ICMPV6_ERRMSG_MAX + 1);
> > +		bitmap_clear(net->ipv6.sysctl.icmpv6_ratemask, ICMPV6_PKT_TOOBIG, 1);
> > +	}
> 
> You're allocating space for ICMPV6_MSG_MAX + 1 "bytes" but you only need enough space
> for that many "bits".  Which is just four 64-bit words, so you can probably inline it.

Doh, I thought I have divided it by 8. I will fix this and probably
inline it. Thanks.