Commit 6482a7a30f520060ddcc7b5330da5fc080d39e0c
Committed by
Ye Li
1 parent
d0c0a6c9f4
Exists in
smarc_8mq_lf_v2020.04
and in
4 other branches
MA-17851 boota: fix dereference before null check
This fixes coverity issue 3776938 and 8666209. Check pointer before reference. Test: Coverity scan. Change-Id: I2b08b7a63226a5a4246eec26db7dda363344369e Signed-off-by: Luo Ji <ji.luo@nxp.com> (cherry picked from commit 3dea9fb836800f93c292999de6f6c1271d947aca)
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
drivers/fastboot/fb_fsl/fb_fsl_boot.c
... | ... | @@ -642,7 +642,8 @@ |
642 | 642 | /* Parse the avb data */ |
643 | 643 | if ((avb_result == AVB_AB_FLOW_RESULT_OK) || |
644 | 644 | (avb_result == AVB_AB_FLOW_RESULT_OK_WITH_VERIFICATION_ERROR)) { |
645 | - assert(avb_out_data != NULL); | |
645 | + if (avb_out_data == NULL) | |
646 | + goto fail; | |
646 | 647 | /* We may have more than one partition loaded by AVB, find the boot partition first.*/ |
647 | 648 | #ifdef CONFIG_SYSTEM_RAMDISK_SUPPORT |
648 | 649 | if (find_partition_data_by_name("boot", avb_out_data, &avb_loadpart)) |
... | ... | @@ -696,7 +697,8 @@ |
696 | 697 | "androidboot.verifiedbootstate=orange androidboot.flash.locked=0 androidboot.slot_suffix=%s ", |
697 | 698 | avb_out_data->ab_suffix); |
698 | 699 | } |
699 | - strcat(bootargs_sec, avb_out_data->cmdline); | |
700 | + if (avb_out_data->cmdline != NULL) | |
701 | + strcat(bootargs_sec, avb_out_data->cmdline); | |
700 | 702 | #ifndef CONFIG_ANDROID_AUTO_SUPPORT |
701 | 703 | /* for standard android, recovery ramdisk will be used anyway, to |
702 | 704 | * boot up Android, "androidboot.force_normal_boot=1" is needed */ |
-
mentioned in commit c8ca50