Commit 4b756b013ae0159d77d34981b57f8590f8dba2ee
1 parent
c2e5e802ec
Exists in
master
and in
50 other branches
hash.c: Correct non-hash subcommand crc32 addr-save support
In the case of not having CONFIG_CMD_HASH but having CONFIG_CMD_CRC32 enabled (and not CONFIG_CRC32_VERIFY), we end up in this part of the code path on hash_command(). However, we will only have exactly 3 args here, and 3 > 3 is false, and we will not try and store the hash at the address given as arg #3. The next problem however is that we've been moving argv around so the third value is now in argv[0] not argv[3]. Confirmed on AM335x Beaglebone White. Signed-off-by: Tom Rini <trini@ti.com>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
common/hash.c
... | ... | @@ -325,8 +325,8 @@ |
325 | 325 | printf("CRC32 for %08lx ... %08lx ==> %08lx\n", |
326 | 326 | addr, addr + len - 1, crc); |
327 | 327 | |
328 | - if (argc > 3) { | |
329 | - ptr = (ulong *)simple_strtoul(argv[3], NULL, 16); | |
328 | + if (argc >= 3) { | |
329 | + ptr = (ulong *)simple_strtoul(argv[0], NULL, 16); | |
330 | 330 | *ptr = crc; |
331 | 331 | } |
332 | 332 | } |