Patchwork [U-Boot,v4,1/7] vsprintf:fix: Change type returned by ustrtoul

login
register
mail settings
Submitter Piotr Wilczek
Date Nov. 9, 2012, 9:22 a.m.
Message ID <1352452938-2375-2-git-send-email-p.wilczek@samsung.com>
Download mbox | patch
Permalink /patch/198000/
State Changes Requested
Delegated to: Tom Rini
Headers show

Comments

Piotr Wilczek - Nov. 9, 2012, 9:22 a.m.
From: Lukasz Majewski <l.majewski@samsung.com>

The ustrtoul shall convert string defined size (e.g. 1GiB) to unsigned
long type (as its name implies).

Up till now it had returned int, which might cause problems with large
numbers (GiB range), when interpreted as U2 signed numbers.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Changes for v3:
- None
Changes for v4:
- None
---
 lib/vsprintf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Stephen Warren - Nov. 19, 2012, 7:19 p.m.
On 11/09/2012 02:22 AM, Piotr Wilczek wrote:
> From: Lukasz Majewski <l.majewski@samsung.com>
> 
> The ustrtoul shall convert string defined size (e.g. 1GiB) to unsigned
> long type (as its name implies).
> 
> Up till now it had returned int, which might cause problems with large
> numbers (GiB range), when interpreted as U2 signed numbers.

Reviewed-by: Stephen Warren <swarren@nvidia.com>

Patch

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b7a79c0..3c432f8 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -103,7 +103,7 @@  long simple_strtol(const char *cp, char **endp, unsigned int base)
 	return simple_strtoul(cp, endp, base);
 }
 
-int ustrtoul(const char *cp, char **endp, unsigned int base)
+unsigned long ustrtoul(const char *cp, char **endp, unsigned int base)
 {
 	unsigned long result = simple_strtoul(cp, endp, base);
 	switch (**endp) {