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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 10 Mar 2014 16:31:59 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	hayeswang@...ltek.com
Cc:	netdev@...r.kernel.org, nic_swsd@...ltek.com,
	linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH net-next] r8152: add skb_cow_head

From: Hayes Wang <hayeswang@...ltek.com>
Date: Mon, 10 Mar 2014 14:22:31 +0800

> Call skb_cow_head() before editing the tx packet header. The header
> would be reallocated if it is shared.
> 
> Signed-off-by: Hayes Wang <hayeswang@...ltek.com>
> ---
>  drivers/net/usb/r8152.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index c7ef30d..faad39b 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -1376,6 +1376,11 @@ static int msdn_giant_send_check(struct sk_buff *skb)
>  {
>  	const struct ipv6hdr *ipv6h;
>  	struct tcphdr *th;
> +	int ret;
> +
> +	ret = skb_cow_head(skb, 0);
> +	if (ret)
> +		goto out1;
>  
>  	ipv6h = ipv6_hdr(skb);
>  	th = tcp_hdr(skb);
> @@ -1383,7 +1388,8 @@ static int msdn_giant_send_check(struct sk_buff *skb)
>  	th->check = 0;
>  	th->check = ~tcp_v6_check(0, &ipv6h->saddr, &ipv6h->daddr, 0);
>  
> -	return 0;
> +out1:
> +	return ret;
>  }
>  
>  static int r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc,

Please just return directly instead of "goto out1".  There are no other
operations or pieces of state to undo if you fail at the beginning of
the function, and the label furthermore will have only one user, so
it seems completely unnecessary.  A simple "return ret" will work just
fine.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ