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: <20200603155208.qmko4nd5on76k7c4@liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net>
Date:   Wed, 3 Jun 2020 15:52:08 +0000
From:   Wei Liu <wei.liu@...nel.org>
To:     Denis Efremov <efremov@...ux.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Paul Durrant <paul@....org>, Wei Liu <wei.liu@...nel.org>,
        xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] xen-netback: use kstrdup() in connect_data_rings()

On Wed, Jun 03, 2020 at 06:26:43PM +0300, Denis Efremov wrote:
> Use kstrdup() instead of opencoded alloc and copy. kzalloc() is
> excessive here.
> 
> Signed-off-by: Denis Efremov <efremov@...ux.com>

Acked-by: Wei Liu <wei.liu@...nel.org>

> ---
>  drivers/net/xen-netback/xenbus.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
> index 286054b60d47..69352154a51b 100644
> --- a/drivers/net/xen-netback/xenbus.c
> +++ b/drivers/net/xen-netback/xenbus.c
> @@ -839,13 +839,12 @@ static int connect_data_rings(struct backend_info *be,
>  	 * queue-N.
>  	 */
>  	if (num_queues == 1) {
> -		xspath = kzalloc(strlen(dev->otherend) + 1, GFP_KERNEL);
> +		xspath = kstrdup(dev->otherend, GFP_KERNEL);
>  		if (!xspath) {
>  			xenbus_dev_fatal(dev, -ENOMEM,
>  					 "reading ring references");
>  			return -ENOMEM;
>  		}
> -		strcpy(xspath, dev->otherend);
>  	} else {
>  		xspathsize = strlen(dev->otherend) + xenstore_path_ext_size;
>  		xspath = kzalloc(xspathsize, GFP_KERNEL);
> -- 
> 2.26.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ