From: Michal Simek Date: Wed, 13 Jun 2018 07:42:41 +0000 (+0200) Subject: arm64: zynqmp: Check return value from calloc X-Git-Tag: v2018.07-rc2~49^2~6 X-Git-Url: https://git.sur5r.net/?p=u-boot;a=commitdiff_plain;h=1e3e68f109d6f4ac934319dee9e7928cfdce895c arm64: zynqmp: Check return value from calloc calloc() can fail and return NULL. The patch is checking return value and return in case of error. Signed-off-by: Michal Simek --- diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 080fb59ef7..81c10fcf8a 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -596,6 +596,8 @@ int board_late_init(void) new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + bootseq_len); + if (!new_targets) + return -ENOMEM; if (bootseq >= 0) sprintf(new_targets, "%s%x %s", mode, bootseq,