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] [day] [month] [year] [list]
Message-ID: <7df4de70-3f98-36f6-711b-27666121a8aa@gmail.com>
Date:   Thu, 18 Jan 2018 16:08:18 +0200
From:   Serhey Popovych <serhe.popovych@...il.com>
To:     netdev@...r.kernel.org
Subject: Re: [PATCH iproute2] tunnel: Return constant string without copying
 it

Serhey Popovych wrote:

> We return constant string from tnl_strproto(), no need
> to copy it to temporary buffer and then return such
> buffer as const: return constant string instead.
> 
> Signed-off-by: Serhey Popovych <serhe.popovych@...il.com>

This change should be ignored: now it is a part of series
of patches with cover letter subject:

  "ip/tunnel: Improve tunnel parameters printing"

since v2.

> ---
>  ip/tunnel.c |   25 +++++++------------------
>  1 file changed, 7 insertions(+), 18 deletions(-)
> 
> diff --git a/ip/tunnel.c b/ip/tunnel.c
> index f860103..946a36c 100644
> --- a/ip/tunnel.c
> +++ b/ip/tunnel.c
> @@ -39,33 +39,22 @@
>  
>  const char *tnl_strproto(__u8 proto)
>  {
> -	static char buf[16];
> -
>  	switch (proto) {
>  	case IPPROTO_IPIP:
> -		strcpy(buf, "ip");
> -		break;
> +		return "ip";
>  	case IPPROTO_GRE:
> -		strcpy(buf, "gre");
> -		break;
> +		return "gre";
>  	case IPPROTO_IPV6:
> -		strcpy(buf, "ipv6");
> -		break;
> +		return "ipv6";
>  	case IPPROTO_ESP:
> -		strcpy(buf, "esp");
> -		break;
> +		return "esp";
>  	case IPPROTO_MPLS:
> -		strcpy(buf, "mpls");
> -		break;
> +		return "mpls";
>  	case 0:
> -		strcpy(buf, "any");
> -		break;
> +		return "any";
>  	default:
> -		strcpy(buf, "unknown");
> -		break;
> +		return "unknown";
>  	}
> -
> -	return buf;
>  }
>  
>  int tnl_get_ioctl(const char *basedev, void *p)
> 




Download attachment "signature.asc" of type "application/pgp-signature" (491 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ