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]
Date:	Wed, 15 Oct 2014 14:27:04 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc:	Joe Perches <joe@...ches.com>,
	Grant Likely <grant.likely@...aro.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andi Kleen <ak@...ux.intel.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] lib: string.c: A speed optimized for strncpy

On Sun, Oct 05, 2014 at 06:01:43PM +0200, Rickard Strandqvist wrote:
> Hi
> 
> Yes, it can be faster, even if it is as you say, probably a difference
> depending on the size of the count.
> And even greater need to test this on a variety of hardware :-/

Most architectures (the notable exception is ARM) have an their own
optimized strncpy() function.  Probably strzcpy() should just call it.

char *strzcpy(char *dest, const char *src, size_t count)
{
	strncpy(dest, src, count);
	if (count)
		dest[count - 1] = '\0';
	return dest;
}

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ