* [PATCH] lib/vsprintf.c: wrong conversion function used
@ 2008-08-07 9:24 Swen Schillig
2008-08-10 15:38 ` Yi Yang
0 siblings, 1 reply; 2+ messages in thread
From: Swen Schillig @ 2008-08-07 9:24 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Yi Yang
From: Swen Schillig <swen@vnet.ibm.com>
The macro define_strict_strtoux() is using the simple_strtoul ()
function as opposed to the simple_strtoull() function.
This leads to false conversions on non-64bit
machines (here 31bit System z).
The following patch fixes the issue introduced by
commit 06b2a76d25d3cfbd14680021c1d356c91be6904e
Author: Yi Yang <yi.y.yang@intel.com>
Date: Fri Feb 8 04:21:57 2008 -0800
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
---
lib/vsprintf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: HEAD/lib/vsprintf.c
===================================================================
--- HEAD.orig/lib/vsprintf.c
+++ HEAD/lib/vsprintf.c
@@ -220,7 +220,7 @@ int strict_strtou##type(const char *cp,
if (len == 0) \
return -EINVAL; \
\
- val = simple_strtoul(cp, &tail, base); \
+ val = simple_strtoull(cp, &tail, base); \
if ((*tail == '\0') || \
((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {\
*res = val; \
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] lib/vsprintf.c: wrong conversion function used
2008-08-07 9:24 [PATCH] lib/vsprintf.c: wrong conversion function used Swen Schillig
@ 2008-08-10 15:38 ` Yi Yang
0 siblings, 0 replies; 2+ messages in thread
From: Yi Yang @ 2008-08-10 15:38 UTC (permalink / raw)
To: Swen Schillig; +Cc: linux-kernel, Andrew Morton
Swen, your fix is just partly correct, it'll has a big problem for strict_strtoul, because val is of long type,
but you patch will result in long long return type, the below patch is a correct fix.
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Noticed-by: Swen Schillig <swen@vnet.ibm.com>
---
vsprintf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 1dc2d1d..d8d1d11 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -220,7 +220,7 @@ int strict_strtou##type(const char *cp, unsigned int base, valtype *res)\
if (len == 0) \
return -EINVAL; \
\
- val = simple_strtoul(cp, &tail, base); \
+ val = simple_strtou##type(cp, &tail, base); \
if ((*tail == '\0') || \
((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {\
*res = val; \
On Thu, 2008-08-07 at 11:24 +0200, Swen Schillig wrote:
> From: Swen Schillig <swen@vnet.ibm.com>
>
> The macro define_strict_strtoux() is using the simple_strtoul ()
> function as opposed to the simple_strtoull() function.
> This leads to false conversions on non-64bit
> machines (here 31bit System z).
>
> The following patch fixes the issue introduced by
>
> commit 06b2a76d25d3cfbd14680021c1d356c91be6904e
> Author: Yi Yang <yi.y.yang@intel.com>
> Date: Fri Feb 8 04:21:57 2008 -0800
>
> Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
> ---
> lib/vsprintf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: HEAD/lib/vsprintf.c
> ===================================================================
> --- HEAD.orig/lib/vsprintf.c
> +++ HEAD/lib/vsprintf.c
> @@ -220,7 +220,7 @@ int strict_strtou##type(const char *cp,
> if (len == 0) \
> return -EINVAL; \
> \
> - val = simple_strtoul(cp, &tail, base); \
> + val = simple_strtoull(cp, &tail, base); \
> if ((*tail == '\0') || \
> ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {\
> *res = val; \
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-11 3:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-07 9:24 [PATCH] lib/vsprintf.c: wrong conversion function used Swen Schillig
2008-08-10 15:38 ` Yi Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox