lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 29 Nov 2022 14:41:20 +0100
From:   Alexander Lobakin <alexandr.lobakin@...el.com>
To:     Paolo Abeni <pabeni@...hat.com>
Cc:     Alexander Lobakin <alexandr.lobakin@...el.com>,
        Coco Li <lixiaoyan@...gle.com>,
        "David S. Miller" <davem@...emloft.net>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        David Ahern <dsahern@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Michael Chan <michael.chan@...adcom.com>,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/2] IPv6/GRO: generic helper to remove temporary HBH/jumbo header in driver

From: Paolo Abeni <pabeni@...hat.com>
Date: Tue, 29 Nov 2022 10:33:59 +0100

> Hello,
> 
> Only a couple of minor things below, reporting them as this is still a
> RFC, right ? ;)
> 
> On Wed, 2022-11-23 at 11:16 -0800, Coco Li wrote:

[...]

> > +static inline int ipv6_hopopt_jumbo_remove(struct sk_buff *skb)

I thinks it's relatively small and inlineable enough to not make it
an external function, right? I'd keep it inline just how the author
does it, the compiler then will decide.

> > +{
> > +	const int hophdr_len = sizeof(struct hop_jumbo_hdr);
> > +	int nexthdr = ipv6_has_hopopt_jumbo(skb);
> > +	struct ipv6hdr *h6;
> > +	int err = 0;
> > +
> > +	if (!nexthdr)
> > +		return err;
> 
> You can help a bit the compiler avoiding err initialization:
> 
> 	int err;
> 
> 	if (!nexthdr)
> 		return 0;

Same with the end of the function, @err is unused after
skb_cow_head() and always equal 0, so the end return could be just
`return 0`.

> 
> > +
> > +	err = skb_cow_head(skb, 0);
> > +	if (err)
> > +		return err;
> > +
> > +	/* Remove the HBH header.
> > +	 * Layout: [Ethernet header][IPv6 header][HBH][L4 Header]
> > +	 */
> > +	memmove(skb_mac_header(skb) + hophdr_len, skb_mac_header(skb),
> > +		skb_network_header(skb) - skb_mac_header(skb) +
> 
> The have could be:
> 
> 		skb_mac_header_len(skb)
> 
> which is IMHO a little more clear.
> 
> Thanks!
> 
> Paolo

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ