tools: ifdtool: Write correct offset on 32-bit machine
authorBin Meng <bmeng.cn@gmail.com>
Mon, 6 Jul 2015 07:57:06 +0000 (15:57 +0800)
committerSimon Glass <sjg@chromium.org>
Wed, 15 Jul 2015 00:03:19 +0000 (18:03 -0600)
On 32-bit machine strtol() returns LONG_MAX which is 0x7fffffff,
which is wrong for u-boot.rom components like u-boot-x86-16bit.bin.
Change to use strtoll() so that it works on both 32-bit and 64-bit
machines.

Reported-by: Fei Wang <wangfei.jimei@gmail.com>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/ifdtool.c

index 1d61df19f231016f0eee82d275bf47c63e258215..df166161f439f7fe66d2f9f2675298e2785bb20f 100644 (file)
@@ -987,7 +987,7 @@ int main(int argc, char *argv[])
                                        print_usage(argv[0]);
                                        exit(EXIT_FAILURE);
                                }
-                               ifile->addr = strtol(optarg, NULL, 0);
+                               ifile->addr = strtoll(optarg, NULL, 0);
                                ifile->type = opt == 'f' ? IF_fdt :
                                        opt == 'U' ? IF_uboot : IF_normal;
                                if (ifile->type == IF_fdt)