summaryrefslogtreecommitdiffstats
path: root/fs/fs.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@denx.de>2014-07-09 22:42:57 +0200
committerTom Rini <trini@ti.com>2014-07-22 07:44:25 -0400
commit949bbd7c867026e7f8ecb71abe6ebd113eda84d2 (patch)
treefa5eb57a7e130854a21c8aa1875f52b6a20c0d90 /fs/fs.c
parent6b367467f154f03e154ade92125ae003083aaf7f (diff)
downloadtalos-obmc-uboot-949bbd7c867026e7f8ecb71abe6ebd113eda84d2.tar.gz
talos-obmc-uboot-949bbd7c867026e7f8ecb71abe6ebd113eda84d2.zip
catch wrong load address passed to fatload / ext2load
If filename is passed instead of address to ext2load or fatload, u-boot silently accepts that, and uses 0 for load address and default filename from environment. That is confusing, display help instead. Signed-off-by: Pavel Machek <pavel@denx.de>
Diffstat (limited to 'fs/fs.c')
-rw-r--r--fs/fs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 79d432d58f..ea15c5f447 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -276,6 +276,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
unsigned long pos;
int len_read;
unsigned long time;
+ char *ep;
if (argc < 2)
return CMD_RET_USAGE;
@@ -286,7 +287,9 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
return 1;
if (argc >= 4) {
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = simple_strtoul(argv[3], &ep, 16);
+ if (ep == argv[3] || *ep != '\0')
+ return CMD_RET_USAGE;
} else {
addr_str = getenv("loadaddr");
if (addr_str != NULL)
OpenPOWER on IntegriCloud