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]
Message-ID: <8fab6f9c-70a6-02fd-5b2d-66a013c10a4f@gmail.com>
Date:   Sun, 13 Oct 2019 12:30:41 -0700
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     Vito Caputo <vcaputo@...garu.com>, davem@...emloft.net
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: core: datagram: tidy up copy functions a bit



On 10/12/19 4:55 AM, Vito Caputo wrote:
> Eliminate some verbosity by using min() macro and consolidating some
> things, also fix inconsistent zero tests (! vs. == 0).
> 
> Signed-off-by: Vito Caputo <vcaputo@...garu.com>
> ---
>  net/core/datagram.c | 44 ++++++++++++++------------------------------
>  1 file changed, 14 insertions(+), 30 deletions(-)
> 
> diff --git a/net/core/datagram.c b/net/core/datagram.c
> index 4cc8dc5db2b7..08d403f93952 100644
> --- a/net/core/datagram.c
> +++ b/net/core/datagram.c
> @@ -413,13 +413,11 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
>  					    struct iov_iter *), void *data)
>  {
>  	int start = skb_headlen(skb);
> -	int i, copy = start - offset, start_off = offset, n;
> +	int i, copy, start_off = offset, n;
>  	struct sk_buff *frag_iter;
>  
>  	/* Copy header. */
> -	if (copy > 0) {
> -		if (copy > len)
> -			copy = len;
> +	if ((copy = min(start - offset, len)) > 0) {

No, we prefer not having this kind of construct anymore.

This refactoring looks unnecessary code churn, making our future backports not
clean cherry-picks.

Simply making sure this patch does not bring a regression is very time consuming.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ