Skip to contentSkip to conversation

net: Fix arguments in tftpput command

PATCH New Simon Glass 3 participants 4 messages Dec 17, 2011 – Dec 18, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Fix arguments in tftpput command

The switch to strict_strtoul() was not done correctly - this fixes the compile error when CONFIG_CMD_TFTPPUT is active.

---
 common/cmd_net.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
common/cmd_net.c +2 -2
index f89a24b..be7cc01 100644
@@ -221,8 +221,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 
 #ifdef CONFIG_CMD_TFTPPUT
 	case 4:
-		save_addr = strict_strtoul(argv[1], NULL, 16);
-		save_size = strict_strtoul(argv[2], NULL, 16);
+		strict_strtoul(argv[1], 16, &save_addr);
+		strict_strtoul(argv[2], 16, &save_size);
 		copy_filename(BootFile, argv[3], sizeof(BootFile));
 		break;
 #endif
Signature · 1 line
1.7.3.1
#2 lore raw

PATCH 1/1 net: Fix arguments in tftpput command

In reply to Simon Glass

Dear Simon Glass,

Quoted 13 lines · In message <[email protected]> you wrote:

The switch to strict_strtoul() was not done correctly - this fixes the compile error when CONFIG_CMD_TFTPPUT is active.

---
 common/cmd_net.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
common/cmd_net.c +0 -0
index f89a24b..be7cc01 100644

common/cmd_net.c static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, · line 225

Quoted 7 lines
common/cmd_net.c +2 -2
@@ -221,8 +221,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 
 #ifdef CONFIG_CMD_TFTPPUT
 	case 4:
-		save_addr = strict_strtoul(argv[1], NULL, 16);
-		save_size = strict_strtoul(argv[2], NULL, 16);
+		strict_strtoul(argv[1], 16, &save_addr);
+		strict_strtoul(argv[2], 16, &save_size);

strict_strtoul() returns error codes. We should not ignore these.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Vulcans believe peace should not depend on force.
	-- Amanda, "Journey to Babel", stardate 3842.3
#3 lore raw

PATCH 1/1 net: Fix arguments in tftpput command

Hi Wolfgang,

Quoted 17 lines · Wolfgang Denk

Dear Simon Glass,

Quoted 14 lines · In message <[email protected]> you wrote:

The switch to strict_strtoul() was not done correctly - this fixes the compile error when CONFIG_CMD_TFTPPUT is active.

---
?common/cmd_net.c | ? ?4 ++--
?1 files changed, 2 insertions(+), 2 deletions(-)

common/cmd_net.c +0 -0
index f89a24b..be7cc01 100644
@@ -221,8 +221,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 
Quoted 8 lines
Quoted 6 lines

?#ifdef CONFIG_CMD_TFTPPUT
? ? ? case 4:
- ? ? ? ? ? ? save_addr = strict_strtoul(argv[1], NULL, 16);
- ? ? ? ? ? ? save_size = strict_strtoul(argv[2], NULL, 16);
+ ? ? ? ? ? ? strict_strtoul(argv[1], 16, &save_addr);
+ ? ? ? ? ? ? strict_strtoul(argv[2], 16, &save_size);

strict_strtoul() returns error codes. ?We should not ignore these.

Er yes, I wondered about that. I will resubmit with a cmd_usage() in that case.

Regards,
Simon

Quoted 11 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Vulcans believe peace should not depend on force.
? ? ? ?-- Amanda, "Journey to Babel", stardate 3842.3