diff options
author | Zhigang <zhigang.yu@amlogic.com> | 2019-03-07 16:14:56 +0800 |
---|---|---|
committer | Dongjin Kim <tobetter@gmail.com> | 2019-05-16 13:19:21 +0900 |
commit | 749840a9d3101b65c8b0d77de8af2b905a831657 (patch) | |
tree | 56dfc26d9243120edcc95ebddd83152124c2917b /common | |
parent | 0dfed294fbc7a77cf891a6d934336a30b5577b27 (diff) | |
download | u-boot-odroid-c1-749840a9d3101b65c8b0d77de8af2b905a831657.tar.gz |
bootm: check out_data NULL before use out_data->cmdline [2/2]
PD#TV-2975
Problem:
uboot can not bootup when no data in vbmeta
Solution:
check out_data NULL before use out_data->cmdline
Verify:
Verifying on p212
Change-Id: I3632e53105dabf7d505fcc43501e9f3b265cebe4
Signed-off-by: Zhigang <zhigang.yu@amlogic.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_bootm.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 24418b2ea0..c4345b4ee4 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -235,14 +235,19 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) bootstate = bootstate_o; else bootstate = bootstate_g; - newbootargs = malloc(strlen(bootargs) + strlen(out_data->cmdline) + strlen(bootstate) + 1 + 1 + 1); - if (!newbootargs) { - printf("failed to allocate buffer for bootarg\n"); - return -1; + + if (out_data) { + newbootargs = malloc(strlen(bootargs) + strlen(out_data->cmdline) + strlen(bootstate) + 1 + 1 + 1); + if (!newbootargs) { + printf("failed to allocate buffer for bootarg\n"); + return -1; + } + sprintf(newbootargs, "%s %s %s", bootargs, out_data->cmdline, bootstate); + setenv("bootargs", newbootargs); + free(newbootargs); + newbootargs = NULL; + avb_slot_verify_data_free(out_data); } - sprintf(newbootargs, "%s %s %s", bootargs, out_data->cmdline, bootstate); - setenv("bootargs", newbootargs); - avb_slot_verify_data_free(out_data); } #endif |