From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2OPC-0002BM-Qj for barebox@lists.infradead.org; Tue, 18 Sep 2018 22:23:42 +0000 Received: by mail-pf1-x441.google.com with SMTP id b11-v6so1685302pfo.3 for ; Tue, 18 Sep 2018 15:23:31 -0700 (PDT) From: Andrey Smirnov Date: Tue, 18 Sep 2018 15:22:57 -0700 Message-Id: <20180918222305.6834-4-andrew.smirnov@gmail.com> In-Reply-To: <20180918222305.6834-1-andrew.smirnov@gmail.com> References: <20180918222305.6834-1-andrew.smirnov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 03/11] ARM: i.MX: bbu: Check retrun value of getenv() To: barebox@lists.infradead.org Cc: Andrey Smirnov Add code to make sure that getenv() returned correct result and bail out if it failed. Signed-off-by: Andrey Smirnov --- 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@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox