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: <alpine.LNX.2.00.1012060120590.16078@swampdragon.chaosbits.net>
Date:	Mon, 6 Dec 2010 01:25:34 +0100 (CET)
From:	Jesper Juhl <jj@...osbits.net>
To:	Alexey Dobriyan <adobriyan@...il.com>
cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/45] kstrtox: converting strings to integers done
 (hopefully) right

On Sun, 5 Dec 2010, Alexey Dobriyan wrote:

> 1. simple_strto*() do not contain overflow checks and crufty,
>    libc way to indicate failure.
> 2. strict_strto*() also do not have overflow checks but the name and
>    comments pretend they do.
> 3. Both families have only "long long" and "long" variants,
>    but users want strtou8()
> 4. Both "simple" and "strict" prefixes are wrong:
>    Simple doesn't exactly say what's so simple, strict should not exist
>    because conversion should be strict by default.
> 
> The solution is to use "k" prefix and add convertors for more types.
> Enter
> 	kstrtoull()
> 	kstrtoll()
> 	kstrtoul()
> 	kstrtol()
> 	kstrtouint()
> 	kstrtoint()
> 	kstrtou64()
> 	kstrtos64()
> 	kstrtou32()
> 	kstrtos32()
> 	kstrtou16()
> 	kstrtos16()
> 	kstrtou8()
> 	kstrtos8()
> 
> Include runtime testsuite (somewhat incomplete) as well.
> 
> strict_strto*() become deprecated, stubbed to kstrto*() and
> eventually will be removed altogether.
> 
> Use kstrto*() in code today!
> 
> Note: sizeof and __alignof__ trick is done to save function call
>       where types aren't distinguishable.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
> ---
<snip>
> +/* Internal, do not use. */
> +int _kstrtol(const char *s, unsigned int base, long *res)
> +{
> +	long long tmp;
> +	int rv;
> +
> +	rv = kstrtoll(s, base, &tmp);
> +	if (rv < 0)
> +		return rv;
> +	if (tmp != (long long)(long)tmp)
> +		return -EINVAL;
> +	*res = tmp;
> +	return 0;
> +}
> +EXPORT_SYMBOL(_kstrtol);

Ok, probably I'm just being dense, but the "_" prefix tells me I probably 
shouldn't use this function. The comment clearly tells me I shouldn't use 
this function.
So, why is this exported? And if it is not/should not be exported, then 
why is it not static?
(goes for other functions in this patch as well).


/Jesper Juhl

--
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