Add code to make sure that getenv() returned correct result and bail out if it failed. Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- arch/arm/mach-imx/imx-bbu-internal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c index 697e59f12..faa266572 100644 --- a/arch/arm/mach-imx/imx-bbu-internal.c +++ b/arch/arm/mach-imx/imx-bbu-internal.c @@ -415,6 +415,11 @@ static int imx_bbu_internal_mmcboot_update(struct bbu_handler *handler, return ret; bootpart = getenv(bootpartvar); + if (!bootpart) { + pr_err("Couldn't read the value of '%s'\n", bootpartvar); + ret = -ENOENT; + goto free_bootpartvar; + } if (!strcmp(bootpart, "boot0")) { bootpart = "boot1"; -- 2.17.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox