]> git.sur5r.net Git - u-boot/commitdiff
arm64: zynqmp: Check return value from calloc
authorMichal Simek <michal.simek@xilinx.com>
Wed, 13 Jun 2018 07:42:41 +0000 (09:42 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 15 Jun 2018 06:54:05 +0000 (08:54 +0200)
calloc() can fail and return NULL. The patch is checking return value
and return in case of error.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/zynqmp/zynqmp.c

index 080fb59ef7bdaa458cc7d2ad833a846f06a85066..81c10fcf8a00c6a227f1967e5d934a2cb2d58f7e 100644 (file)
@@ -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,